Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WEB-2697] chore: draft issue listing #5874

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions apiserver/plane/api/views/cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,11 +404,7 @@ def delete(self, request, slug, project_id, pk):
epoch=int(timezone.now().timestamp()),
)
# Delete the cycle
cycle.delete()
# Delete the cycle issues
CycleIssue.objects.filter(
cycle_id=self.kwargs.get("pk"),
).delete()
cycle.delete(soft=False)
# Delete the user favorite cycle
UserFavorite.objects.filter(
entity_type="cycle",
Expand Down
9 changes: 3 additions & 6 deletions apiserver/plane/app/views/cycle/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,12 +490,9 @@ def destroy(self, request, slug, project_id, pk):
notification=True,
origin=request.META.get("HTTP_ORIGIN"),
)
# Delete the cycle
cycle.delete()
# Delete the cycle issues
CycleIssue.objects.filter(
cycle_id=self.kwargs.get("pk"),
).delete()
# TODO: Soft delete the cycle break the onetoone relationship with cycle issue
cycle.delete(soft=False)
Comment on lines +493 to +494
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Implement soft deletion for cycles

Currently, the destroy method performs a hard delete with cycle.delete(soft=False), which contradicts the PR's objective to implement soft deletion for cycles. The TODO comment indicates that soft deleting the cycle breaks the one-to-one relationship with CycleIssue. Addressing this issue will allow cycles to be soft-deleted as intended, maintaining data integrity and consistency.

Would you like assistance in resolving the relationship issue to enable soft deletion? I can help modify the deletion logic to preserve associations while soft deleting the cycle.


# Delete the user favorite cycle
UserFavorite.objects.filter(
user=request.user,
Expand Down
4 changes: 2 additions & 2 deletions apiserver/plane/app/views/workspace/draft.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def get_queryset(self):
.annotate(
cycle_id=Case(
When(
issue_cycle__cycle__deleted_at__isnull=True,
then=F("issue_cycle__cycle_id"),
draft_issue_cycle__cycle__deleted_at__isnull=True,
then=F("draft_issue_cycle__cycle_id"),
),
default=None,
)
Expand Down
Loading