diff --git a/rhodecode/apps/my_account/views/my_account.py b/rhodecode/apps/my_account/views/my_account.py --- a/rhodecode/apps/my_account/views/my_account.py +++ b/rhodecode/apps/my_account/views/my_account.py @@ -735,7 +735,7 @@ class MyAccountView(BaseAppView, DataGri for pr in pull_requests: repo_id = pr.target_repo_id comments_count = comments_model.get_all_comments( - repo_id, pull_request=pr, count_only=True) + repo_id, pull_request=pr, include_drafts=False, count_only=True) owned = pr.user_id == self._rhodecode_user.user_id data.append({ diff --git a/rhodecode/apps/repository/views/repo_pull_requests.py b/rhodecode/apps/repository/views/repo_pull_requests.py --- a/rhodecode/apps/repository/views/repo_pull_requests.py +++ b/rhodecode/apps/repository/views/repo_pull_requests.py @@ -107,7 +107,8 @@ class RepoPullRequestsView(RepoAppView, comments_model = CommentsModel() for pr in pull_requests: comments_count = comments_model.get_all_comments( - self.db_repo.repo_id, pull_request=pr, count_only=True) + self.db_repo.repo_id, pull_request=pr, + include_drafts=False, count_only=True) data.append({ 'name': _render('pullrequest_name', diff --git a/rhodecode/model/comment.py b/rhodecode/model/comment.py --- a/rhodecode/model/comment.py +++ b/rhodecode/model/comment.py @@ -563,7 +563,8 @@ class CommentsModel(BaseModel): return comment - def get_all_comments(self, repo_id, revision=None, pull_request=None, count_only=False): + def get_all_comments(self, repo_id, revision=None, pull_request=None, + include_drafts=True, count_only=False): q = ChangesetComment.query()\ .filter(ChangesetComment.repo_id == repo_id) if revision: @@ -573,6 +574,8 @@ class CommentsModel(BaseModel): q = q.filter(ChangesetComment.pull_request_id == pull_request.pull_request_id) else: raise Exception('Please specify commit or pull_request') + if not include_drafts: + q = q.filter(ChangesetComment.draft == false()) q = q.order_by(ChangesetComment.created_on) if count_only: return q.count() diff --git a/rhodecode/templates/codeblocks/diffs.mako b/rhodecode/templates/codeblocks/diffs.mako --- a/rhodecode/templates/codeblocks/diffs.mako +++ b/rhodecode/templates/codeblocks/diffs.mako @@ -273,7 +273,7 @@ return '%s_%s_%i' % (h.md5_safe(commit+f