Changeset - 0cb43732260b
[Not reviewed]
default
0 2 0
Mads Kiilerich - 9 years ago 2016-05-23 18:02:33
madski@unity3d.com
pullrequests: make it easier to see what needs attention on "my" list; list PRs needing attention separately
2 files changed with 15 insertions and 4 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/pullrequests.py
Show inline comments
 
@@ -210,29 +210,37 @@ class PullrequestsController(BaseRepoCon
 

	
 
        def _filter(pr):
 
            s = sorted(pr, key=lambda o: o.created_on, reverse=True)
 
            if not c.closed:
 
                s = filter(lambda p: p.status != PullRequest.STATUS_CLOSED, s)
 
            return s
 

	
 
        c.my_pull_requests = _filter(PullRequest.query() \
 
                                .filter(PullRequest.user_id ==
 
                                        self.authuser.user_id) \
 
                                .all())
 

	
 
        c.participate_in_pull_requests = _filter(PullRequest.query() \
 
                                .join(PullRequestReviewers) \
 
        c.participate_in_pull_requests = []
 
        c.participate_in_pull_requests_todo = []
 
        done_status = set([ChangesetStatus.STATUS_APPROVED, ChangesetStatus.STATUS_REJECTED])
 
        for pr in _filter(PullRequest.query()
 
                                .join(PullRequestReviewers)
 
                                .filter(PullRequestReviewers.user_id ==
 
                                        self.authuser.user_id) \
 
                                                 )
 
                                        self.authuser.user_id)
 
                         ):
 
            status = pr.user_review_status(c.authuser.user_id) # very inefficient!!!
 
            if status in done_status:
 
                c.participate_in_pull_requests.append(pr)
 
            else:
 
                c.participate_in_pull_requests_todo.append(pr)
 

	
 
        return render('/pullrequests/pullrequest_show_my.html')
 

	
 
    @LoginRequired()
 
    @NotAnonymous()
 
    @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
 
                                   'repository.admin')
 
    def index(self):
 
        org_repo = c.db_repo
 
        org_scm_instance = org_repo.scm_instance
 
        try:
 
            org_scm_instance.get_changeset()
kallithea/templates/pullrequests/pullrequest_show_my.html
Show inline comments
 
@@ -26,17 +26,20 @@
 
        <div>
 
        %if c.closed:
 
            ${h.link_to(_('Hide closed pull requests (only show open pull requests)'), h.url('my_pullrequests'))}
 
        %else:
 
            ${h.link_to(_('Show closed pull requests (in addition to open pull requests)'), h.url('my_pullrequests',closed=1))}
 
        %endif
 
        </div>
 
    </div>
 

	
 
    <div class="pullrequests_section_head">${_('Pull Requests Created by Me')}</div>
 
    ${pullrequest_data.pullrequest_overview(c.my_pull_requests)}
 

	
 
    <div class="pullrequests_section_head" style="clear:both">${_('Pull Requests Needing My Review')}</div>
 
    ${pullrequest_data.pullrequest_overview(c.participate_in_pull_requests_todo)}
 

	
 
    <div class="pullrequests_section_head" style="clear:both">${_('Pull Requests I Participate In')}</div>
 
    ${pullrequest_data.pullrequest_overview(c.participate_in_pull_requests)}
 

	
 
</div>
 
</%def>
0 comments (0 inline, 0 general)