Show More
@@ -200,7 +200,6 b' class ChangesetController(BaseRepoContro' | |||
|
200 | 200 | |
|
201 | 201 | c.commit_statuses = ChangesetStatus.STATUSES |
|
202 | 202 | c.inline_comments = [] |
|
203 | c.inline_cnt = 0 | |
|
204 | 203 | c.files = [] |
|
205 | 204 | |
|
206 | 205 | c.statuses = [] |
@@ -254,7 +253,8 b' class ChangesetController(BaseRepoContro' | |||
|
254 | 253 | |
|
255 | 254 | inline_comments = ChangesetCommentsModel().get_inline_comments( |
|
256 | 255 | c.rhodecode_db_repo.repo_id, revision=commit.raw_id) |
|
257 |
c.inline_cnt |
|
|
256 | c.inline_cnt = ChangesetCommentsModel().get_inline_comments_count( | |
|
257 | inline_comments) | |
|
258 | 258 | |
|
259 | 259 | diffset = codeblocks.DiffSet( |
|
260 | 260 | repo_name=c.repo_name, |
@@ -720,7 +720,8 b' class PullrequestsController(BaseRepoCon' | |||
|
720 | 720 | c.inline_comments = cc_model.get_inline_comments( |
|
721 | 721 | c.rhodecode_db_repo.repo_id, |
|
722 | 722 | pull_request=pull_request_id) |
|
723 | c.inline_cnt = len(c.inline_comments) | |
|
723 | ||
|
724 | c.inline_cnt = cc_model.get_inline_comments_count(c.inline_comments) | |
|
724 | 725 | |
|
725 | 726 | self._load_compare_data( |
|
726 | 727 | c.pull_request, c.inline_comments, enable_comments=enable_comments) |
@@ -354,6 +354,16 b' class ChangesetCommentsModel(BaseModel):' | |||
|
354 | 354 | q = self._get_inline_comments_query(repo_id, revision, pull_request) |
|
355 | 355 | return self._group_comments_by_path_and_line_number(q) |
|
356 | 356 | |
|
357 | def get_inline_comments_count(self, inline_comments, skip_outdated=True, | |
|
358 | version=None): | |
|
359 | inline_cnt = 0 | |
|
360 | for fname, per_line_comments in inline_comments.iteritems(): | |
|
361 | for lno, comments in per_line_comments.iteritems(): | |
|
362 | inline_cnt += len( | |
|
363 | [comm for comm in comments | |
|
364 | if (not comm.outdated and skip_outdated)]) | |
|
365 | return inline_cnt | |
|
366 | ||
|
357 | 367 | def get_outdated_comments(self, repo_id, pull_request): |
|
358 | 368 | # TODO: johbo: Remove `repo_id`, it is not needed to find the comments |
|
359 | 369 | # of a pull request. |
@@ -810,7 +810,9 b' def assert_inline_comments(pull_request,' | |||
|
810 | 810 | if visible is not None: |
|
811 | 811 | inline_comments = ChangesetCommentsModel().get_inline_comments( |
|
812 | 812 | pull_request.target_repo.repo_id, pull_request=pull_request) |
|
813 | assert len(inline_comments) == visible | |
|
813 | inline_cnt = ChangesetCommentsModel().get_inline_comments_count( | |
|
814 | inline_comments) | |
|
815 | assert inline_cnt == visible | |
|
814 | 816 | if outdated is not None: |
|
815 | 817 | outdated_comments = ChangesetCommentsModel().get_outdated_comments( |
|
816 | 818 | pull_request.target_repo.repo_id, pull_request) |
General Comments 0
You need to be logged in to leave comments.
Login now