[WEB-1986] fix: remove the user favourites when archived a particular entity#5387
[WEB-1986] fix: remove the user favourites when archived a particular entity#5387sriramveeraghanta merged 3 commits intopreviewfrom
Conversation
WalkthroughThe recent updates enhance the API server's cycle, module, and project management by ensuring that user favorites are automatically deleted when their corresponding entities are archived. This change improves data integrity and user experience by preventing stale references to inactive cycles, modules, and projects. Additionally, error handling has been streamlined across various endpoints to utilize a centralized error codes dictionary, improving maintainability and clarity in error responses. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant API
participant Database
User->>API: Archive Cycle/Module/Project
API->>Database: Update archived_at timestamp
Database-->>API: Confirm update
API->>Database: Delete associated UserFavorites
Database-->>API: Confirm deletion
API-->>User: Success response
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (10)
- apiserver/plane/api/views/cycle.py (1 hunks)
- apiserver/plane/api/views/module.py (1 hunks)
- apiserver/plane/api/views/project.py (1 hunks)
- apiserver/plane/app/views/cycle/archive.py (1 hunks)
- apiserver/plane/app/views/issue/archive.py (2 hunks)
- apiserver/plane/app/views/issue/bulk_operations.py (4 hunks)
- apiserver/plane/app/views/module/archive.py (1 hunks)
- apiserver/plane/app/views/page/base.py (4 hunks)
- apiserver/plane/app/views/project/base.py (1 hunks)
- apiserver/plane/utils/error_codes.py (1 hunks)
Files skipped from review due to trivial changes (1)
- apiserver/plane/utils/error_codes.py
Additional comments not posted (14)
apiserver/plane/app/views/issue/bulk_operations.py (3)
24-24: LGTM: Centralized error codes import.The import of
ERROR_CODESenhances maintainability by centralizing error code management.
76-78: LGTM: Use of centralized error codes for invalid issue dates.Using
ERROR_CODESfor error handling improves consistency and maintainability.
169-171: LGTM: Use of centralized error codes for invalid issue target dates.The usage of
ERROR_CODESfor error handling is consistent and maintainable.apiserver/plane/app/views/issue/archive.py (2)
50-50: LGTM: Centralized error codes import.The import of
ERROR_CODESenhances maintainability by centralizing error code management.
349-351: LGTM: Use of centralized error codes for invalid archive state group.Using
ERROR_CODESfor error handling improves consistency and maintainability.apiserver/plane/api/views/project.py (1)
380-383: LGTM: Deletion of user favorites when archiving a project.The logic ensures that user favorites are cleaned up when a project is archived, maintaining data integrity.
apiserver/plane/app/views/page/base.py (3)
36-36: LGTM: Centralized error codes import.The import of
ERROR_CODESenhances maintainability by centralizing error code management.
308-313: LGTM: Deletion of user favorites when archiving a page.The logic ensures that user favorites are cleaned up when a page is archived, maintaining data integrity.
528-541: LGTM: Use of centralized error codes for page lock and archive errors.Using
ERROR_CODESfor error handling improves consistency and maintainability.apiserver/plane/app/views/module/archive.py (1)
578-583: Ensure consistency in user favorite deletion logic.The logic for deleting user favorites when a module is archived is consistent with the PR objectives. Ensure similar logic is applied consistently across other entity types as needed.
apiserver/plane/app/views/cycle/archive.py (1)
610-615: Consistency in user favorite deletion logic.The addition of user favorite deletion logic when a cycle is archived aligns with the PR objectives. Ensure this logic is consistently applied across all relevant entity types.
apiserver/plane/api/views/module.py (1)
637-642: Consistency in user favorite deletion logic.The addition of user favorite deletion logic when a module is archived aligns with the PR objectives. Ensure this logic is consistently applied across all relevant entity types.
apiserver/plane/app/views/project/base.py (1)
496-499: Consistency in user favorite deletion logic.The addition of user favorite deletion logic when a project is archived aligns with the PR objectives. Ensure this logic is consistently applied across all relevant entity types.
apiserver/plane/api/views/cycle.py (1)
547-552: LGTM! Verify the deletion logic for user favorites.The code correctly deletes user favorites associated with the cycle when it is archived. Ensure that the deletion logic covers all relevant cases.
Verify that the
UserFavoritemodel and the deletion logic are correctly implemented and cover all necessary fields.
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- apiserver/plane/app/urls/issue.py (2 hunks)
- apiserver/plane/app/views/init.py (1 hunks)
- apiserver/plane/app/views/view/base.py (2 hunks)
Files skipped from review due to trivial changes (1)
- apiserver/plane/app/views/init.py
Additional comments not posted (3)
apiserver/plane/app/urls/issue.py (1)
Line range hint
1-306: Verify the impact of removingBulkIssueOperationsEndpoint.The removal of the
BulkIssueOperationsEndpointroute may impact clients relying on this functionality. Ensure that this change is intentional and documented. Verify if there are any references to this endpoint elsewhere in the codebase.Verification successful
No references to
BulkIssueOperationsEndpointfound.The search did not reveal any remaining references to
BulkIssueOperationsEndpointin the codebase, suggesting that its removal does not affect other components. Ensure that this change is intentional and properly documented to avoid potential issues.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify references to `BulkIssueOperationsEndpoint` in the codebase. # Test: Search for references to the removed endpoint. Expect: No references remain. rg --type python 'BulkIssueOperationsEndpoint'Length of output: 77
Script:
#!/bin/bash # Description: Verify references to `BulkIssueOperationsEndpoint` in the codebase. # Test: Search for references to the removed endpoint. Expect: No references remain. rg --type py 'BulkIssueOperationsEndpoint'Length of output: 42
apiserver/plane/app/views/view/base.py (2)
Line range hint
152-204: Review the removal of permission checks indestroy.The
destroymethod now allows deletions without specific role or ownership checks. Ensure that this change is justified and consider the potential security implications.
Line range hint
1-152: Review the removal of role-based access control inretrieve.The
retrievemethod now allows all users to execute it, regardless of their roles. Ensure that this change is intentional and consider the potential security implications.
fix:
Issue Link: WEB-1986
Summary by CodeRabbit
New Features
Bug Fixes
Chores