Changeset - 5be4d7d6ac05
[Not reviewed]
default
0 1 0
Mads Kiilerich - 10 years ago 2015-09-03 17:34:19
madski@unity3d.com
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.)
1 file changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
kallithea/model/comment.py
Show inline comments
 
@@ -254,24 +254,24 @@ class ChangesetCommentsModel(BaseModel):
 
        return paths.items()
 

	
 
    def _get_comments(self, repo_id, revision=None, pull_request=None, inline=False):
 
        """
 
        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)\
 
                .filter(ChangesetComment.f_path != None)
 
        else:
 
            q = q.filter(ChangesetComment.line_no == None)\
 
                .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)
 
        else:
 
            raise Exception('Please specify either revision or pull_request')
 

	
0 comments (0 inline, 0 general)