# HG changeset patch # User Mads Kiilerich # Date 2015-09-03 17:34:19 # Node ID 5be4d7d6ac0507c8f40d1b0dc8ad78e90f3a7897 # Parent c3ecdd622168c27a757081c28406c2a4e57424e9 pull requests: don't filter on repo when finding comments for a PR Filtering on repo while finding comments for a PR would miss some. Fix that. The existing data model is inconsistent; PRs already have two repos and programming errors could easily make the one on a comment wrong. (Revision comments do however need the repo reference.) diff --git a/kallithea/model/comment.py b/kallithea/model/comment.py --- a/kallithea/model/comment.py +++ b/kallithea/model/comment.py @@ -257,8 +257,7 @@ class ChangesetCommentsModel(BaseModel): """ Gets comments for either revision or pull_request_id, either inline or general. """ - q = Session().query(ChangesetComment)\ - .filter(ChangesetComment.repo_id == repo_id) + q = Session().query(ChangesetComment) if inline: q = q.filter(ChangesetComment.line_no != None)\ @@ -268,7 +267,8 @@ class ChangesetCommentsModel(BaseModel): .filter(ChangesetComment.f_path == None) if revision: - q = q.filter(ChangesetComment.revision == revision) + q = q.filter(ChangesetComment.revision == revision)\ + .filter(ChangesetComment.repo_id == repo_id) elif pull_request: pull_request = self.__get_pull_request(pull_request) q = q.filter(ChangesetComment.pull_request == pull_request)