[WEB-2479] fix: merge default and archived issue details endpoint.#5882
[WEB-2479] fix: merge default and archived issue details endpoint.#5882
Conversation
WalkthroughThe pull request introduces significant modifications to the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 7
🧹 Outside diff range and nitpick comments (6)
web/core/hooks/use-issue-peek-overview-redirection.tsx (1)
25-29: Approved: Improved readability and added contextThe changes enhance the code in two ways:
- The if-else structure is more readable than the previous ternary operator.
- The addition of the
isArchivedproperty provides more context about the issue's status.Consider making the
isArchivedcheck more explicit:-setPeekIssue({ workspaceSlug, projectId: project_id, issueId: id, nestingLevel, isArchived: !!archived_at }); +setPeekIssue({ workspaceSlug, projectId: project_id, issueId: id, nestingLevel, isArchived: archived_at !== null });This change makes it clearer that an issue is considered archived when
archived_atis not null, which might be more intuitive for other developers.web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/archives/issues/(detail)/header.tsx (1)
27-30: LGTM! Consider minor optimization.The changes in the
useSWRhook are consistent with the service refactoring and align with the PR objectives. The removal of the "ARCHIVED" parameter streamlines the issue retrieval process.Consider moving the
toString()calls to the service method implementation for better separation of concerns:? () => issueService.retrieve(workspaceSlug, projectId, archivedIssueId)This would allow the service to handle any necessary type conversions internally, keeping the component code cleaner.
web/core/components/issues/peek-overview/view.tsx (1)
Line range hint
1-269: Consider refactoring for improved maintainabilityWhile the current change is beneficial, the overall complexity of the
IssueViewcomponent is noteworthy. Consider refactoring this large component into smaller, more focused components. This could improve maintainability, testability, and separation of concerns. Some suggestions:
- Extract modal logic into separate components.
- Create a custom hook for peek overview logic.
- Separate the rendering logic for different peek modes into individual components.
This refactoring would align with the PR's goal of creating a more streamlined approach to handling issue details.
web/core/components/issues/issue-layouts/list/block.tsx (1)
80-86: LGTM! Consider using a more explicit boolean conversion.The addition of the
isArchivedproperty to thesetPeekIssuecall aligns well with the PR objective of merging default and archived issue detail endpoints. This change ensures that the peek overview is aware of the issue's archived status, which can be beneficial for UI rendering or subsequent API calls.For improved clarity, consider using a more explicit boolean conversion:
- isArchived: !!issue.archived_at, + isArchived: issue.archived_at !== null,This makes the intention clearer and avoids potential confusion with falsy values.
web/core/components/issues/peek-overview/root.tsx (2)
105-105: Consider enhancing error handlingWhile removing unused error parameters improves code cleanliness, completely omitting error logging might hinder future debugging efforts. Consider adding a generic error logging mechanism that doesn't expose sensitive information but still provides useful debug data.
For example, you could create a utility function:
const logError = (method: string, error: unknown) => { console.error(`Error in ${method}:`, error instanceof Error ? error.message : 'Unknown error'); };Then use it in catch blocks:
catch (error) { logError('removeIssue', error); setToast({ title: "Error!", type: TOAST_TYPE.ERROR, message: "Issue delete failed", }); // ... rest of the code }This approach balances code cleanliness with maintainability.
Also applies to: 120-121, 127-127, 148-148, 174-174, 203-203, 245-245, 308-308
321-321: LGTM: Updated dependencies, minor suggestionGood job adding
is_draftto the dependencies array of theuseMemohook. This ensures thatissueOperationsis correctly memoized based on all its dependencies.Minor suggestion: Consider maintaining a consistent order of dependencies across the component for better readability and to ensure consistent memoization. You might want to alphabetize the dependencies or group them by their source (e.g., props, hooks, etc.).
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (11)
- apiserver/plane/app/views/issue/base.py (1 hunks)
- web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/archives/issues/(detail)/[archivedIssueId]/page.tsx (1 hunks)
- web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/archives/issues/(detail)/header.tsx (2 hunks)
- web/core/components/cycles/active-cycle/cycle-stats.tsx (1 hunks)
- web/core/components/issues/issue-layouts/list/block.tsx (1 hunks)
- web/core/components/issues/issue-layouts/roots/archived-issue-layout-root.tsx (1 hunks)
- web/core/components/issues/peek-overview/root.tsx (12 hunks)
- web/core/components/issues/peek-overview/view.tsx (1 hunks)
- web/core/hooks/use-issue-peek-overview-redirection.tsx (1 hunks)
- web/core/store/issue/issue-details/issue.store.ts (3 hunks)
- web/core/store/issue/issue-details/root.store.ts (2 hunks)
🧰 Additional context used
🔇 Additional comments (14)
web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/archives/issues/(detail)/[archivedIssueId]/page.tsx (1)
32-32: Verify impact on archived issue retrieval and consider component naming.The removal of the "ARCHIVED" parameter aligns with the PR objective to merge default and archived issue detail endpoints. This change simplifies the API call and creates a more unified approach to fetching issue details.
However, please ensure that:
- The backend API still correctly retrieves archived issues without this parameter.
- The component still displays archived issues as intended.
Additionally, if this component is no longer specific to archived issues, consider updating its name and file path to reflect its more general purpose.
To verify the impact of this change, please run the following script:
This script will help identify any remaining references to archived issues in the codebase, which may need to be updated for consistency with this change.
web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/archives/issues/(detail)/header.tsx (1)
Line range hint
1-85: Summary: Successful refactoring with minimal impact.The changes in this file effectively implement the PR objectives by refactoring the issue service usage. The modifications are focused and maintain the overall structure of the component, suggesting a low-risk change. These updates should improve code consistency and simplify issue management across the application.
web/core/store/issue/issue-details/issue.store.ts (3)
85-85: LGTM! Consistent method signature update.The
fetchIssuemethod signature has been correctly updated to useissueStatusinstead ofissueType, maintaining consistency with the interface change. The default value of "DEFAULT" ensures backwards compatibility.
102-104: LGTM! Verify main issue service handling.The simplification of the conditional logic aligns with the PR objective. The removal of the "ARCHIVED" check reduces complexity and potential branching in the code.
Please confirm that the main issue service (
this.issueService.retrieve) is now capable of handling both default and archived issues. Run the following script to check the implementation of theretrievemethod:#!/bin/bash # Check the implementation of the retrieve method in the IssueService rg -A 10 'class IssueService' | rg -A 20 'retrieve\('
Line range hint
1-248: Overall assessment: Consistent simplification of issue status handling.The changes in this file consistently remove the distinction between default and archived issues, aligning with the PR objectives. This simplification should lead to more streamlined issue management. However, it's crucial to ensure that this change is reflected consistently across the entire codebase and that the main issue service can now handle both default and archived issues appropriately.
To ensure consistency across the codebase, please run the following script to check for any remaining references to archived issues that might need updating:
#!/bin/bash # Search for references to archived issues that might need updating rg 'archived.*issue' --type tsweb/core/components/issues/peek-overview/view.tsx (1)
69-69: Improved null check forembedRemoveCurrentNotificationThis change enhances the robustness of the
removeRoutePeekIdfunction by adding a null check forembedRemoveCurrentNotification. This prevents potential runtime errors ifembedRemoveCurrentNotificationis undefined, which aligns with the PR's objective of addressing minor issues and creating a more streamlined approach.web/core/components/issues/peek-overview/root.tsx (5)
3-3: LGTM: Good addition ofuseCallbackAdding
useCallbackto the imports is a positive change. It sets the stage for optimizing the component's performance by memoizing callback functions.
49-52: LGTM: OptimizedremoveRoutePeekIdwithuseCallbackGreat job wrapping
removeRoutePeekIdwithuseCallback. This optimization can help prevent unnecessary re-renders in child components that receive this function as a prop. The dependency array is correctly populated with all the variables used within the function.
59-62: LGTM: Improved error handling and simplified conditionThe changes in the
fetchmethod are positive:
- The simplified condition for
is_draftimproves code readability.- Adding error logging in the catch block is beneficial for debugging purposes.
These modifications enhance the overall quality and maintainability of the code.
347-347: LGTM: Updatedis_archivedprop usageThe change to
is_archived={!!peekIssue.isArchived}is a good adaptation to the new data structure. Using the double negation (!!) ensures a boolean value, which is a best practice when working with potentially undefined values.This change correctly aligns with the removal of the
is_archivedprop from the component's interface and the updates in theIssueDetailclass mentioned in the summary.
Line range hint
1-354: Overall assessment: Good improvements with minor suggestionsThe changes in this file generally improve code quality, performance, and consistency. Key improvements include:
- Addition of
useCallbackfor performance optimization.- Simplification of conditions and prop handling.
- Alignment with changes in related components and data structures.
Consider the following suggestions for further improvement:
- Enhance error handling to balance code cleanliness with debugging capabilities.
- Maintain consistent ordering of dependencies in hooks for better readability and reliable memoization.
These changes align well with the PR objectives of merging default and archived issue detail endpoints and streamlining the approach to handling issue details.
web/core/components/cycles/active-cycle/cycle-stats.tsx (1)
175-180: LGTM: Improved handling of archived issuesThe addition of the
isArchivedproperty to thesetPeekIssuecall enhances the consistency in handling archived issues across components. This change aligns with the broader refactoring mentioned in the PR summary.web/core/store/issue/issue-details/root.store.ts (2)
40-40: LGTM: Addition ofisArchivedpropertyThe addition of the optional
isArchivedproperty toTPeekIssuetype is a good change. It allows for indicating whether an issue is archived, which aligns with the PR objective of merging default and archived issue details endpoints. The optional nature of the property ensures backward compatibility.
Line range hint
1-456: Summary: Changes align with PR objectivesThe modifications in this file, including the addition of the
isArchivedproperty toTPeekIssueand the update to thefetchIssuemethod signature, are consistent with the PR objective of merging default and archived issue details endpoints. These changes improve code clarity and structure without introducing backward compatibility issues.
| <ArchivedIssueListLayout /> | ||
| </div> | ||
| <IssuePeekOverview is_archived /> | ||
| <IssuePeekOverview /> |
There was a problem hiding this comment.
💡 Codebase verification
Remaining usage of is_archived prop detected in the following files:
web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/archives/issues/(detail)/[archivedIssueId]/page.tsxweb/core/components/issues/issue-detail/root.tsxweb/core/components/issues/peek-overview/view.tsx
🔗 Analysis chain
Verify the removal of is_archived prop from IssuePeekOverview
The is_archived prop has been removed from the IssuePeekOverview component. This change aligns with the PR objective of merging the default and archived issue detail endpoints and removing the archived status check.
However, to ensure this change doesn't introduce any unintended side effects:
- Confirm that the
IssuePeekOverviewcomponent can now handle both archived and non-archived issues correctly without this prop. - Verify that this change is consistent with updates in the
IssuePeekOverviewcomponent implementation.
To verify this change, please run the following script:
This script will help us confirm that the is_archived prop has been consistently removed from the IssuePeekOverview component and its usage across the codebase.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any remaining uses of 'is_archived' prop in IssuePeekOverview
# Search for IssuePeekOverview component definition
echo "IssuePeekOverview component definition:"
ast-grep --pattern 'const IssuePeekOverview = $_' -A 10
# Search for uses of IssuePeekOverview component
echo "\nUses of IssuePeekOverview component:"
rg '<IssuePeekOverview' -A 3 -g '!archived-issue-layout-root.tsx'
# Check if 'is_archived' is still used in the component
echo "\nChecking for 'is_archived' usage in IssuePeekOverview:"
rg 'is_archived' $(rg -l 'const IssuePeekOverview = $_')
Length of output: 8618
| import { useProject } from "@/hooks/store"; | ||
| // services | ||
| import { IssueArchiveService } from "@/services/issue"; | ||
| import { IssueService } from "@/services/issue"; |
There was a problem hiding this comment.
💡 Codebase verification
Unresolved references to IssueArchiveService found.
The following files still reference IssueArchiveService:
web/core/services/issue/issue_archive.service.tsweb/core/store/issue/issue-details/issue.store.tsweb/core/store/issue/helpers/base-issues.store.ts
Please update these to use IssueService as per the refactoring.
🔗 Analysis chain
LGTM! Verify impact on other components.
The change from IssueArchiveService to IssueService aligns with the PR objective of merging default and archived issue endpoints. This refactoring improves code consistency and maintainability.
To ensure this change doesn't introduce unintended side effects, please run the following script to check for any remaining references to IssueArchiveService:
Also applies to: 18-18
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any remaining references to IssueArchiveService
# Test: Search for IssueArchiveService usage
rg 'IssueArchiveService'
Length of output: 621
| projectId: string, | ||
| issueId: string, | ||
| issueType?: "DEFAULT" | "DRAFT" | "ARCHIVED" | ||
| issueStatus?: "DEFAULT" | "DRAFT", |
There was a problem hiding this comment.
💡 Codebase verification
Unresolved references to "ARCHIVED" found.
web/core/constants/issue.ts: ARCHIVED = "ARCHIVED",
🔗 Analysis chain
LGTM! Verify impact on codebase.
The simplification of the issueStatus parameter aligns with the PR objective. This change removes the distinction between default and archived issues at the interface level, which should simplify issue handling.
Please run the following script to ensure that there are no remaining references to the "ARCHIVED" status in the codebase:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for any remaining references to "ARCHIVED" status
rg '"ARCHIVED"' --type ts
Length of output: 4764
Script:
#!/bin/bash
# Search for any remaining references to "ARCHIVED" status
rg '"ARCHIVED"' --type ts
Length of output: 80
|
|
||
| export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => { | ||
| const { embedIssue = false, embedRemoveCurrentNotification, is_archived = false, is_draft = false } = props; | ||
| const { embedIssue = false, embedRemoveCurrentNotification, is_draft = false } = props; |
There was a problem hiding this comment.
💡 Codebase verification
is_archived Prop Still in Use
The is_archived prop is still being referenced in multiple files, indicating incomplete removal. Please review and update all usages accordingly to prevent potential issues.
web/core/components/issues/peek-overview/root.tsxweb/core/components/issues/peek-overview/view.tsxweb/core/components/issues/issue-detail/root.tsxweb/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/archives/issues/(detail)/[archivedIssueId]/page.tsx
🔗 Analysis chain
Verify the removal of is_archived prop
The removal of the is_archived prop aligns with the changes mentioned in the summary. This simplification is good, but please ensure that all uses of this prop throughout the codebase have been updated accordingly to prevent any potential bugs.
To verify this change, run the following command to check for any remaining uses of is_archived:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
rg "is_archived" --type tsx --type ts
Length of output: 65
Script:
#!/bin/bash
# Searching for 'is_archived' in .ts and .tsx files
rg "is_archived" --glob "*.ts" --glob "*.tsx"
Length of output: 2428
| issueStatus: "DEFAULT" | "DRAFT" = "DEFAULT" | ||
| ) => this.issue.fetchIssue(workspaceSlug, projectId, issueId, issueStatus); |
There was a problem hiding this comment.
💡 Codebase verification
Potential Issues: Incomplete fetchIssue Calls Identified
The following calls to fetchIssue are missing the issueStatus parameter:
web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/archives/issues/(detail)/[archivedIssueId])/page.tsx:32web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/issues/(detail)/[issueId])/page.tsx:38web/core/components/issues/issue-detail/root.tsx:86
Please update these calls to include the issueStatus argument as per the new method signature.
🔗 Analysis chain
LGTM: Updated fetchIssue method signature
The update to the fetchIssue method signature is a good change. Renaming issueType to issueStatus improves clarity, and removing "ARCHIVED" as a possible value aligns with the PR objective of merging default and archived issue details endpoints.
To ensure this change doesn't break existing code, please verify all calls to fetchIssue across the codebase. Run the following script to find all occurrences:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Find all calls to fetchIssue method
# Expected result: All calls should use "DEFAULT" or "DRAFT" as the last argument, or omit it entirely
rg -p 'fetchIssue\s*\([^)]*\)' --type ts
Length of output: 857
| Issue.objects.filter( | ||
| project_id=self.kwargs.get("project_id") | ||
| ) | ||
| .filter(workspace__slug=self.kwargs.get("slug")) | ||
| .select_related("workspace", "project", "state", "parent") | ||
| .prefetch_related("assignees", "labels", "issue_module__module") | ||
| .annotate( | ||
| cycle_id=Case( | ||
| When( | ||
| issue_cycle__cycle__deleted_at__isnull=True, | ||
| then=F("issue_cycle__cycle_id"), | ||
| ), | ||
| default=None, | ||
| ) | ||
| ) | ||
| .annotate( | ||
| link_count=IssueLink.objects.filter(issue=OuterRef("id")) | ||
| .order_by() | ||
| .annotate(count=Func(F("id"), function="Count")) | ||
| .values("count") | ||
| ) | ||
| .annotate( | ||
| attachment_count=FileAsset.objects.filter( | ||
| issue_id=OuterRef("id"), | ||
| entity_type=FileAsset.EntityTypeContext.ISSUE_ATTACHMENT, | ||
| ) | ||
| .order_by() | ||
| .annotate(count=Func(F("id"), function="Count")) | ||
| .values("count") | ||
| ) | ||
| .annotate( | ||
| sub_issues_count=Issue.issue_objects.filter( | ||
| parent=OuterRef("id") | ||
| ) | ||
| .order_by() | ||
| .annotate(count=Func(F("id"), function="Count")) | ||
| .values("count") | ||
| ) |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Refactor repeated queryset logic into a helper method
The queryset annotations and prefetches in the retrieve method are similar to those in partial_update. To reduce code duplication and enhance maintainability, consider refactoring this logic into a shared helper method or modifying get_queryset() to include the necessary annotations.
Use self.get_queryset() to ensure consistent querying
In the retrieve method, you're directly querying Issue.objects instead of using self.get_queryset(). This may bypass filters, annotations, or prefetches defined in get_queryset(), potentially leading to inconsistencies. It's recommended to use self.get_queryset().filter(pk=pk) to maintain consistency across the viewset methods.
Apply this diff to fix the issue:
-def retrieve(self, request, slug, project_id, pk=None):
- project = Project.objects.get(pk=project_id, workspace__slug=slug)
-
- issue = (
- Issue.objects.filter(
- project_id=self.kwargs.get("project_id")
- )
- .filter(workspace__slug=self.kwargs.get("slug"))
- .select_related("workspace", "project", "state", "parent")
- .prefetch_related("assignees", "labels", "issue_module__module")
- .annotate(
- cycle_id=Case(
- When(
- issue_cycle__cycle__deleted_at__isnull=True,
- then=F("issue_cycle__cycle_id"),
- ),
- default=None,
- )
- )
- .annotate(
- link_count=IssueLink.objects.filter(issue=OuterRef("id"))
- .order_by()
- .annotate(count=Func(F("id"), function="Count"))
- .values("count")
- )
- .annotate(
- attachment_count=FileAsset.objects.filter(
- issue_id=OuterRef("id"),
- entity_type=FileAsset.EntityTypeContext.ISSUE_ATTACHMENT,
- )
- .order_by()
- .annotate(count=Func(F("id"), function="Count"))
- .values("count")
- )
- .annotate(
- sub_issues_count=Issue.issue_objects.filter(
- parent=OuterRef("id")
- )
- .order_by()
- .annotate(count=Func(F("id"), function="Count"))
- .values("count")
- )
- .filter(pk=pk)
- .annotate(
- # Annotations...
- )
- .prefetch_related(
- # Prefetches...
- )
- ).first()
+ issue = (
+ self.get_queryset()
+ .filter(pk=pk)
+ .annotate(
+ label_ids=Coalesce(
+ ArrayAgg(
+ "labels__id",
+ distinct=True,
+ filter=(
+ ~Q(labels__id__isnull=True)
+ & Q(labels__deleted_at__isnull=True)
+ ),
+ ),
+ Value([], output_field=ArrayField(UUIDField())),
+ ),
+ assignee_ids=Coalesce(
+ ArrayAgg(
+ "assignees__id",
+ distinct=True,
+ filter=~Q(assignees__id__isnull=True)
+ & Q(assignees__member_project__is_active=True),
+ ),
+ Value([], output_field=ArrayField(UUIDField())),
+ ),
+ module_ids=Coalesce(
+ ArrayAgg(
+ "issue_module__module_id",
+ distinct=True,
+ filter=~Q(issue_module__module_id__isnull=True)
+ & Q(issue_module__module__archived_at__isnull=True)
+ & Q(issue_module__module__deleted_at__isnull=True),
+ ),
+ Value([], output_field=ArrayField(UUIDField())),
+ ),
+ )
+ .prefetch_related(
+ Prefetch(
+ "issue_reactions",
+ queryset=IssueReaction.objects.select_related(
+ "issue", "actor"
+ ),
+ )
+ )
+ .prefetch_related(
+ Prefetch(
+ "issue_link",
+ queryset=IssueLink.objects.select_related("created_by"),
+ )
+ )
+ .annotate(
+ is_subscribed=Exists(
+ IssueSubscriber.objects.filter(
+ workspace__slug=slug,
+ project_id=project_id,
+ issue_id=OuterRef("pk"),
+ subscriber=request.user,
+ )
+ )
+ )
+ .first()
+ )📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| Issue.objects.filter( | |
| project_id=self.kwargs.get("project_id") | |
| ) | |
| .filter(workspace__slug=self.kwargs.get("slug")) | |
| .select_related("workspace", "project", "state", "parent") | |
| .prefetch_related("assignees", "labels", "issue_module__module") | |
| .annotate( | |
| cycle_id=Case( | |
| When( | |
| issue_cycle__cycle__deleted_at__isnull=True, | |
| then=F("issue_cycle__cycle_id"), | |
| ), | |
| default=None, | |
| ) | |
| ) | |
| .annotate( | |
| link_count=IssueLink.objects.filter(issue=OuterRef("id")) | |
| .order_by() | |
| .annotate(count=Func(F("id"), function="Count")) | |
| .values("count") | |
| ) | |
| .annotate( | |
| attachment_count=FileAsset.objects.filter( | |
| issue_id=OuterRef("id"), | |
| entity_type=FileAsset.EntityTypeContext.ISSUE_ATTACHMENT, | |
| ) | |
| .order_by() | |
| .annotate(count=Func(F("id"), function="Count")) | |
| .values("count") | |
| ) | |
| .annotate( | |
| sub_issues_count=Issue.issue_objects.filter( | |
| parent=OuterRef("id") | |
| ) | |
| .order_by() | |
| .annotate(count=Func(F("id"), function="Count")) | |
| .values("count") | |
| ) | |
| issue = ( | |
| self.get_queryset() | |
| .filter(pk=pk) | |
| .annotate( | |
| label_ids=Coalesce( | |
| ArrayAgg( | |
| "labels__id", | |
| distinct=True, | |
| filter=( | |
| ~Q(labels__id__isnull=True) | |
| & Q(labels__deleted_at__isnull=True) | |
| ), | |
| ), | |
| Value([], output_field=ArrayField(UUIDField())), | |
| ), | |
| assignee_ids=Coalesce( | |
| ArrayAgg( | |
| "assignees__id", | |
| distinct=True, | |
| filter=~Q(assignees__id__isnull=True) | |
| & Q(assignees__member_project__is_active=True), | |
| ), | |
| Value([], output_field=ArrayField(UUIDField())), | |
| ), | |
| module_ids=Coalesce( | |
| ArrayAgg( | |
| "issue_module__module_id", | |
| distinct=True, | |
| filter=~Q(issue_module__module_id__isnull=True) | |
| & Q(issue_module__module__archived_at__isnull=True) | |
| & Q(issue_module__module__deleted_at__isnull=True), | |
| ), | |
| Value([], output_field=ArrayField(UUIDField())), | |
| ), | |
| ) | |
| .prefetch_related( | |
| Prefetch( | |
| "issue_reactions", | |
| queryset=IssueReaction.objects.select_related( | |
| "issue", "actor" | |
| ), | |
| ) | |
| ) | |
| .prefetch_related( | |
| Prefetch( | |
| "issue_link", | |
| queryset=IssueLink.objects.select_related("created_by"), | |
| ) | |
| ) | |
| .annotate( | |
| is_subscribed=Exists( | |
| IssueSubscriber.objects.filter( | |
| workspace__slug=slug, | |
| project_id=project_id, | |
| issue_id=OuterRef("pk"), | |
| subscriber=request.user, | |
| ) | |
| ) | |
| ) | |
| .first() | |
| ) |
rahulramesha
left a comment
There was a problem hiding this comment.
@prateekshourya29 , pull request looks good, but can you check with product if an issue is archived should the sub issues also be archived
This PR merges the default and archived issue detail endpoints to resolve minor issues caused by incorrect API calls. It also removes the archived status check for a more streamlined approach.
Media
This is one of the above mentioned scenario:
Before
Screen.Recording.2024-10-21.at.6.00.12.PM.mov
After
Screen.Recording.2024-10-21.at.5.59.38.PM.mov
Issue link: WEB-2479
Summary by CodeRabbit
Release Notes
New Features
isArchivedproperty to various components for better state management of issues.Bug Fixes
Refactor
Documentation