Skip to content

Commit ec41ae6

Browse files
chore: removed the deleted votes and reaction (#6218)
1 parent 5773c2b commit ec41ae6

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

apiserver/plane/space/utils/grouper.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ def issue_on_results(issues, group_by, sub_group_by):
9191
Case(
9292
When(
9393
votes__isnull=False,
94+
votes__deleted_at__isnull=True,
9495
then=JSONObject(
9596
vote=F("votes__vote"),
9697
actor_details=JSONObject(
@@ -117,13 +118,14 @@ def issue_on_results(issues, group_by, sub_group_by):
117118
default=None,
118119
output_field=JSONField(),
119120
),
120-
filter=Q(votes__isnull=False),
121+
filter=Q(votes__isnull=False,votes__deleted_at__isnull=True),
121122
distinct=True,
122123
),
123124
reaction_items=ArrayAgg(
124125
Case(
125126
When(
126127
issue_reactions__isnull=False,
128+
issue_reactions__deleted_at__isnull=True,
127129
then=JSONObject(
128130
reaction=F("issue_reactions__reaction"),
129131
actor_details=JSONObject(
@@ -150,7 +152,7 @@ def issue_on_results(issues, group_by, sub_group_by):
150152
default=None,
151153
output_field=JSONField(),
152154
),
153-
filter=Q(issue_reactions__isnull=False),
155+
filter=Q(issue_reactions__isnull=False, issue_reactions__deleted_at__isnull=True),
154156
distinct=True,
155157
),
156158
).values(*required_fields, "vote_items", "reaction_items")

apiserver/plane/space/views/issue.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,7 @@ def get(self, request, anchor, issue_id):
701701
Case(
702702
When(
703703
votes__isnull=False,
704+
votes__deleted_at__isnull=True,
704705
then=JSONObject(
705706
vote=F("votes__vote"),
706707
actor_details=JSONObject(
@@ -732,7 +733,11 @@ def get(self, request, anchor, issue_id):
732733
output_field=JSONField(),
733734
),
734735
filter=Case(
735-
When(votes__isnull=False, then=True),
736+
When(
737+
votes__isnull=False,
738+
votes__deleted_at__isnull=True,
739+
then=True,
740+
),
736741
default=False,
737742
output_field=JSONField(),
738743
),
@@ -742,6 +747,7 @@ def get(self, request, anchor, issue_id):
742747
Case(
743748
When(
744749
issue_reactions__isnull=False,
750+
issue_reactions__deleted_at__isnull=True,
745751
then=JSONObject(
746752
reaction=F("issue_reactions__reaction"),
747753
actor_details=JSONObject(
@@ -775,7 +781,11 @@ def get(self, request, anchor, issue_id):
775781
output_field=JSONField(),
776782
),
777783
filter=Case(
778-
When(issue_reactions__isnull=False, then=True),
784+
When(
785+
issue_reactions__isnull=False,
786+
issue_reactions__deleted_at__isnull=True,
787+
then=True,
788+
),
779789
default=False,
780790
output_field=JSONField(),
781791
),

0 commit comments

Comments
 (0)