Skip to content

Commit 3bdf140

Browse files
committed
models: Override 'create' for PatchComment to automatically remove the PatchInterest for the commenting user
Signed-off-by: andrepapoti <[email protected]>
1 parent 9bf01c8 commit 3bdf140

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

patchwork/models.py

+6
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,12 @@ def save(self, *args, **kwargs):
822822
super(PatchComment, self).save(*args, **kwargs)
823823
self.patch.refresh_tag_counts()
824824

825+
def create(self, *args, **kwargs):
826+
submitter = kwargs.get('submitter')
827+
patch = kwargs.get('patch')
828+
PatchInterest.objects.delete(user=submitter.user, patch=patch)
829+
super(PatchComment, self).create(*args, **kwargs)
830+
825831
def delete(self, *args, **kwargs):
826832
super(PatchComment, self).delete(*args, **kwargs)
827833
self.patch.refresh_tag_counts()

0 commit comments

Comments
 (0)