# HG changeset patch # User Marcin Kuzminski # Date 2017-04-27 16:06:51 # Node ID 69c8cca7522107e4707e321118097e678ee280b1 # Parent fd7ef99092e6e77950dd5c053bbb9c69dd73cae4 pull-requests: make sure we process comments in the order of IDS when linking them. - random order could be problematic diff --git a/rhodecode/model/pull_request.py b/rhodecode/model/pull_request.py --- a/rhodecode/model/pull_request.py +++ b/rhodecode/model/pull_request.py @@ -806,13 +806,15 @@ class PullRequestModel(BaseModel): """ pull_request = pull_request_version.pull_request - comments = ChangesetComment.query().filter( - # TODO: johbo: Should we query for the repo at all here? - # Pending decision on how comments of PRs are to be related - # to either the source repo, the target repo or no repo at all. - ChangesetComment.repo_id == pull_request.target_repo.repo_id, - ChangesetComment.pull_request == pull_request, - ChangesetComment.pull_request_version == None) + comments = ChangesetComment.query()\ + .filter( + # TODO: johbo: Should we query for the repo at all here? + # Pending decision on how comments of PRs are to be related + # to either the source repo, the target repo or no repo at all. + ChangesetComment.repo_id == pull_request.target_repo.repo_id, + ChangesetComment.pull_request == pull_request, + ChangesetComment.pull_request_version == None)\ + .order_by(ChangesetComment.comment_id.asc()) # TODO: johbo: Find out why this breaks if it is done in a bulk # operation.