changeset 5460:5be4d7d6ac05

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.)
author Mads Kiilerich <madski@unity3d.com>
date Thu, 03 Sep 2015 17:34:19 +0200
parents c3ecdd622168
children cc157dcedba6
files kallithea/model/comment.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/model/comment.py	Thu Sep 03 15:40:57 2015 +0200
+++ b/kallithea/model/comment.py	Thu Sep 03 17:34:19 2015 +0200
@@ -257,8 +257,7 @@
         """
         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 @@
                 .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)