##// END OF EJS Templates
comments: counts exclude now draft comments, they shouldn't be visible.
milka -
r4553:e8a9a30e default
parent child Browse files
Show More
@@ -735,7 +735,7 b' class MyAccountView(BaseAppView, DataGri'
735 for pr in pull_requests:
735 for pr in pull_requests:
736 repo_id = pr.target_repo_id
736 repo_id = pr.target_repo_id
737 comments_count = comments_model.get_all_comments(
737 comments_count = comments_model.get_all_comments(
738 repo_id, pull_request=pr, count_only=True)
738 repo_id, pull_request=pr, include_drafts=False, count_only=True)
739 owned = pr.user_id == self._rhodecode_user.user_id
739 owned = pr.user_id == self._rhodecode_user.user_id
740
740
741 data.append({
741 data.append({
@@ -107,7 +107,8 b' class RepoPullRequestsView(RepoAppView, '
107 comments_model = CommentsModel()
107 comments_model = CommentsModel()
108 for pr in pull_requests:
108 for pr in pull_requests:
109 comments_count = comments_model.get_all_comments(
109 comments_count = comments_model.get_all_comments(
110 self.db_repo.repo_id, pull_request=pr, count_only=True)
110 self.db_repo.repo_id, pull_request=pr,
111 include_drafts=False, count_only=True)
111
112
112 data.append({
113 data.append({
113 'name': _render('pullrequest_name',
114 'name': _render('pullrequest_name',
@@ -563,7 +563,8 b' class CommentsModel(BaseModel):'
563
563
564 return comment
564 return comment
565
565
566 def get_all_comments(self, repo_id, revision=None, pull_request=None, count_only=False):
566 def get_all_comments(self, repo_id, revision=None, pull_request=None,
567 include_drafts=True, count_only=False):
567 q = ChangesetComment.query()\
568 q = ChangesetComment.query()\
568 .filter(ChangesetComment.repo_id == repo_id)
569 .filter(ChangesetComment.repo_id == repo_id)
569 if revision:
570 if revision:
@@ -573,6 +574,8 b' class CommentsModel(BaseModel):'
573 q = q.filter(ChangesetComment.pull_request_id == pull_request.pull_request_id)
574 q = q.filter(ChangesetComment.pull_request_id == pull_request.pull_request_id)
574 else:
575 else:
575 raise Exception('Please specify commit or pull_request')
576 raise Exception('Please specify commit or pull_request')
577 if not include_drafts:
578 q = q.filter(ChangesetComment.draft == false())
576 q = q.order_by(ChangesetComment.created_on)
579 q = q.order_by(ChangesetComment.created_on)
577 if count_only:
580 if count_only:
578 return q.count()
581 return q.count()
@@ -273,7 +273,7 b" return '%s_%s_%i' % (h.md5_safe(commit+f"
273 <label for="filediff-collapse-${id(filediff)}" class="filediff-heading">
273 <label for="filediff-collapse-${id(filediff)}" class="filediff-heading">
274 <%
274 <%
275 file_comments = (get_inline_comments(inline_comments, filediff.patch['filename']) or {}).values()
275 file_comments = (get_inline_comments(inline_comments, filediff.patch['filename']) or {}).values()
276 total_file_comments = [_c for _c in h.itertools.chain.from_iterable(file_comments) if not _c.outdated]
276 total_file_comments = [_c for _c in h.itertools.chain.from_iterable(file_comments) if not (_c.outdated or _c.draft)]
277 %>
277 %>
278 <div class="filediff-collapse-indicator icon-"></div>
278 <div class="filediff-collapse-indicator icon-"></div>
279
279
General Comments 0
You need to be logged in to leave comments. Login now