From a15c90a3342ea072e1a280e13af4015865fc6a97 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jun 27 2016 17:39:59 +0000 Subject: Hide the notifications when showing the number of comments on a ticket --- diff --git a/pagure/lib/model.py b/pagure/lib/model.py index ac973cd..a87f035 100644 --- a/pagure/lib/model.py +++ b/pagure/lib/model.py @@ -616,6 +616,12 @@ class Issue(BASE): ''' Return the list of issue this issue blocks on in simple text. ''' return [issue.id for issue in self.parents] + @property + def user_comments(self): + ''' Return user comments only, filter it from notifications + ''' + return [comment for comment in self.comments if not comment.notification] + def to_json(self, public=False, with_comments=True): ''' Returns a dictionary representation of the issue. diff --git a/pagure/templates/issues.html b/pagure/templates/issues.html index d664157..b1c4330 100644 --- a/pagure/templates/issues.html +++ b/pagure/templates/issues.html @@ -125,11 +125,11 @@ {{ issue.title | noJS("img") | safe }}    - {% if issue.comments|count > 0 %} + {% if issue.user_comments|count > 0 %} - {{issue.comments|count}} + {{issue.user_comments|count}} {% endif %} {% for tag in issue.tags%}