In Comment.save() and Comment.delete(), we always call Submission.refresh_tag_counts(), which is an empty stub, rather than calling Patch.refresh_tag_counts() if the Submission is a Patch.
As such, tag counts are never updated on incoming comments. Delete Submission.refresh_tag_counts(), as it's useless, and in Comment.save()/delete(), invoke Patch.refresh_tag_counts() directly when the submission is a Patch. Reported-by: David Demelier <mark...@malikania.fr> Fixes: 86172ccc161b ("models: Split Patch into two models") Closes-bug: #111 ("A/R/T not updated on comments") Signed-off-by: Andrew Donnellan <andrew.donnel...@au1.ibm.com> --- patchwork/models.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/patchwork/models.py b/patchwork/models.py index 56daea1..f8d2472 100644 --- a/patchwork/models.py +++ b/patchwork/models.py @@ -350,10 +350,6 @@ class Submission(FilenameMixin, EmailMixin, models.Model): # patchwork metadata - def refresh_tag_counts(self): - # This is subclassed on 'Patch' to do something useful - pass - def is_editable(self, user): return False @@ -578,11 +574,13 @@ class Comment(EmailMixin, models.Model): def save(self, *args, **kwargs): super(Comment, self).save(*args, **kwargs) - self.submission.refresh_tag_counts() + if hasattr(self.submission, 'patch'): + self.submission.patch.refresh_tag_counts() def delete(self, *args, **kwargs): super(Comment, self).delete(*args, **kwargs) - self.submission.refresh_tag_counts() + if hasattr(self.submission, 'patch'): + self.submission.patch.refresh_tag_counts() class Meta: ordering = ['date'] -- 2.11.0 _______________________________________________ Patchwork mailing list Patchwork@lists.ozlabs.org https://lists.ozlabs.org/listinfo/patchwork