aboutsummaryrefslogtreecommitdiff
path: root/rhodecode/controllers/changeset.py
diff options
context:
space:
mode:
Diffstat (limited to 'rhodecode/controllers/changeset.py')
-rw-r--r--rhodecode/controllers/changeset.py25
1 files changed, 20 insertions, 5 deletions
diff --git a/rhodecode/controllers/changeset.py b/rhodecode/controllers/changeset.py
index 68a21d37..f982f04f 100644
--- a/rhodecode/controllers/changeset.py
+++ b/rhodecode/controllers/changeset.py
@@ -221,13 +221,25 @@ class ChangesetController(BaseRepoController):
for changeset in c.cs_ranges:
inlines = []
if method == 'show':
- c.statuses.extend([ChangesetStatusModel()\
- .get_status(c.rhodecode_db_repo.repo_id,
- changeset.raw_id)])
+ c.statuses.extend([ChangesetStatusModel().get_status(
+ c.rhodecode_db_repo.repo_id, changeset.raw_id)])
c.comments.extend(ChangesetCommentsModel()\
.get_comments(c.rhodecode_db_repo.repo_id,
revision=changeset.raw_id))
+
+ #comments from PR
+ st = ChangesetStatusModel().get_statuses(
+ c.rhodecode_db_repo.repo_id, changeset.raw_id,
+ with_revisions=True)
+ # from associated statuses, check the pull requests, and
+ # show comments from them
+
+ prs = set([x.pull_request for x in
+ filter(lambda x: x.pull_request != None, st)])
+
+ for pr in prs:
+ c.comments.extend(pr.comments)
inlines = ChangesetCommentsModel()\
.get_inline_comments(c.rhodecode_db_repo.repo_id,
revision=changeset.raw_id)
@@ -269,6 +281,9 @@ class ChangesetController(BaseRepoController):
cs_changes[''] = [None, None, None, None, diff, None]
c.changes[changeset.raw_id] = cs_changes
+ #sort comments by how they were generated
+ c.comments = sorted(c.comments, key=lambda x: x.comment_id)
+
# count inline comments
for __, lines in c.inline_comments:
for comments in lines.values():
@@ -342,7 +357,7 @@ class ChangesetController(BaseRepoController):
)
except StatusChangeOnClosedPullRequestError:
log.error(traceback.format_exc())
- msg = _('Changing status on a changeset associated with'
+ msg = _('Changing status on a changeset associated with '
'a closed pull request is not allowed')
h.flash(msg, category='warning')
return redirect(h.url('changeset_home', repo_name=repo_name,
@@ -371,7 +386,7 @@ class ChangesetController(BaseRepoController):
@jsonify
def delete_comment(self, repo_name, comment_id):
co = ChangesetComment.get(comment_id)
- owner = lambda: co.author.user_id == c.rhodecode_user.user_id
+ owner = co.author.user_id == c.rhodecode_user.user_id
if h.HasPermissionAny('hg.admin', 'repository.admin')() or owner:
ChangesetCommentsModel().delete(comment=co)
Session().commit()