Skip to content

Commit 51b52a7

Browse files
[WEB-3249] chore: delete the user recent visits (#6496)
* chore: delete the user recent visits * chore: hard deleted the recent visits
1 parent 23ede81 commit 51b52a7

File tree

5 files changed

+40
-0
lines changed

5 files changed

+40
-0
lines changed

apiserver/plane/app/views/cycle/base.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
User,
4848
Project,
4949
ProjectMember,
50+
UserRecentVisit,
5051
)
5152
from plane.utils.analytics_plot import burndown_plot
5253
from plane.bgtasks.recent_visited_task import recent_visited_task
@@ -543,6 +544,13 @@ def destroy(self, request, slug, project_id, pk):
543544
entity_identifier=pk,
544545
project_id=project_id,
545546
).delete()
547+
# Delete the cycle from recent visits
548+
UserRecentVisit.objects.filter(
549+
project_id=project_id,
550+
workspace__slug=slug,
551+
entity_identifier=pk,
552+
entity_name="cycle",
553+
).delete(soft=False)
546554
return Response(status=status.HTTP_204_NO_CONTENT)
547555

548556

apiserver/plane/app/views/issue/base.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
Project,
4545
ProjectMember,
4646
CycleIssue,
47+
UserRecentVisit,
4748
)
4849
from plane.utils.grouper import (
4950
issue_group_values,
@@ -671,6 +672,13 @@ def destroy(self, request, slug, project_id, pk=None):
671672
issue = Issue.objects.get(workspace__slug=slug, project_id=project_id, pk=pk)
672673

673674
issue.delete()
675+
# delete the issue from recent visits
676+
UserRecentVisit.objects.filter(
677+
project_id=project_id,
678+
workspace__slug=slug,
679+
entity_identifier=pk,
680+
entity_name="issue",
681+
).delete(soft=False)
674682
issue_activity.delay(
675683
type="issue.activity.deleted",
676684
requested_data=json.dumps({"issue_id": str(pk)}),

apiserver/plane/app/views/module/base.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
ModuleLink,
5555
ModuleUserProperties,
5656
Project,
57+
UserRecentVisit,
5758
)
5859
from plane.utils.analytics_plot import burndown_plot
5960
from plane.utils.timezone_converter import user_timezone_converter
@@ -808,6 +809,13 @@ def destroy(self, request, slug, project_id, pk):
808809
entity_identifier=pk,
809810
project_id=project_id,
810811
).delete()
812+
# delete the module from recent visits
813+
UserRecentVisit.objects.filter(
814+
project_id=project_id,
815+
workspace__slug=slug,
816+
entity_identifier=pk,
817+
entity_name="module",
818+
).delete(soft=False)
811819
return Response(status=status.HTTP_204_NO_CONTENT)
812820

813821

apiserver/plane/app/views/page/base.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
ProjectMember,
3434
ProjectPage,
3535
Project,
36+
UserRecentVisit,
3637
)
3738
from plane.utils.error_codes import ERROR_CODES
3839
from ..base import BaseAPIView, BaseViewSet
@@ -387,6 +388,13 @@ def destroy(self, request, slug, project_id, pk):
387388
entity_identifier=pk,
388389
entity_type="page",
389390
).delete()
391+
# Delete the page from recent visit
392+
UserRecentVisit.objects.filter(
393+
project_id=project_id,
394+
workspace__slug=slug,
395+
entity_identifier=pk,
396+
entity_name="page",
397+
).delete(soft=False)
390398
return Response(status=status.HTTP_204_NO_CONTENT)
391399

392400

apiserver/plane/app/views/view/base.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
ProjectMember,
2525
Project,
2626
CycleIssue,
27+
UserRecentVisit,
2728
)
2829
from plane.utils.grouper import (
2930
issue_group_values,
@@ -495,6 +496,13 @@ def destroy(self, request, slug, project_id, pk):
495496
entity_identifier=pk,
496497
entity_type="view",
497498
).delete()
499+
# Delete the page from recent visit
500+
UserRecentVisit.objects.filter(
501+
project_id=project_id,
502+
workspace__slug=slug,
503+
entity_identifier=pk,
504+
entity_name="view",
505+
).delete(soft=False)
498506
else:
499507
return Response(
500508
{"error": "Only admin or owner can delete the view"},

0 commit comments

Comments
 (0)