Changeset - 1c4505e3be5b
[Not reviewed]
beta
0 3 0
Marcin Kuzminski - 13 years ago 2013-02-20 02:15:12
marcin@python-works.com
show flags, and desc sort pull request based on created_date ref #765
3 files changed with 17 insertions and 4 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/admin/settings.py
Show inline comments
 
@@ -474,18 +474,22 @@ class SettingsController(BaseController)
 

	
 
    @NotAnonymous()
 
    def my_account_my_pullrequests(self):
 
        c.my_pull_requests = PullRequest.query()\
 
                                .filter(PullRequest.user_id ==
 
                                        self.rhodecode_user.user_id)\
 
                                .order_by(PullRequest.created_on.desc())\
 
                                .all()
 
        c.participate_in_pull_requests = \
 

	
 
        c.participate_in_pull_requests = sorted(
 
            [x.pull_request for x in PullRequestReviewers.query()\
 
                                    .filter(PullRequestReviewers.user_id ==
 
                                            self.rhodecode_user.user_id)\
 
                                    .all()]
 
                                    .all()],
 
                                    key=lambda o: o.created_on, reverse=True)
 

	
 
        return render('admin/users/user_edit_my_account_pullrequests.html')
 

	
 
    @NotAnonymous()
 
    def create_repository(self):
 
        """GET /_admin/create_repository: Form to create a new item"""
 
        new_repo = request.GET.get('repo', '')
rhodecode/model/pull_request.py
Show inline comments
 
@@ -52,13 +52,13 @@ class PullRequestModel(BaseModel):
 
        return self._get_instance(PullRequest, pull_request)
 

	
 
    def get_all(self, repo):
 
        repo = self._get_repo(repo)
 
        return PullRequest.query()\
 
                .filter(PullRequest.other_repo == repo)\
 
                .order_by(PullRequest.created_on)\
 
                .order_by(PullRequest.created_on.desc())\
 
                .all()
 

	
 
    def create(self, created_by, org_repo, org_ref, other_repo, other_ref,
 
               revisions, reviewers, title, description=None):
 
        from rhodecode.model.changeset_status import ChangesetStatusModel
 

	
 
@@ -75,13 +75,13 @@ class PullRequestModel(BaseModel):
 
        new.title = title
 
        new.description = description
 
        new.author = created_by_user
 
        self.sa.add(new)
 
        Session().flush()
 
        #members
 
        for member in reviewers:
 
        for member in set(reviewers):
 
            _usr = self._get_user(member)
 
            reviewer = PullRequestReviewers(_usr, new)
 
            self.sa.add(reviewer)
 

	
 
        #reset state to under-review
 
        ChangesetStatusModel().set_status(
 
@@ -113,12 +113,13 @@ class PullRequestModel(BaseModel):
 
            'pr_user_created': h.person(created_by_user.email),
 
            'pr_repo_url': h.url('summary_home', repo_name=other_repo.repo_name,
 
                                 qualified=True,),
 
            'pr_url': pr_url,
 
            'pr_revisions': revisions
 
        }
 

	
 
        notif.create(created_by=created_by_user, subject=subject, body=body,
 
                     recipients=reviewers,
 
                     type_=Notification.TYPE_PULL_REQUEST, email_kwargs=kwargs)
 
        return new
 

	
 
    def update_reviewers(self, pull_request, reviewers_ids):
rhodecode/templates/admin/users/user_edit_my_account_pullrequests.html
Show inline comments
 
@@ -3,12 +3,16 @@
 
<ul>
 
    %if c.my_pull_requests:
 
      %for pull_request in c.my_pull_requests:
 
      <li>
 
        <div style="height: 12px">
 
          <div style="float:left">
 
          %if pull_request.is_closed():
 
              <img src="${h.url('/images/icons/lock_go.png')}" title="${_('Closed')}"/>
 
          %endif
 
          <img src="${h.url('/images/icons/flag_status_%s.png' % str(pull_request.last_review_status))}" />          
 
          <a href="${h.url('pullrequest_show',repo_name=pull_request.other_repo.repo_name,pull_request_id=pull_request.pull_request_id)}">
 
          ${_('Pull request #%s opened on %s') % (pull_request.pull_request_id, h.fmt_date(pull_request.created_on))}
 
          </a>
 
          </div>
 
          <div style="float:left;margin-top: -5px">
 
            ${h.form(url('pullrequest_delete', repo_name=pull_request.other_repo.repo_name, pull_request_id=pull_request.pull_request_id),method='delete')}
 
@@ -26,12 +30,16 @@
 
<div class="pullrequests_section_head" style="clear:both">${_('I participate in')}</div>
 
<ul>
 
    %if c.participate_in_pull_requests:
 
      %for pull_request in c.participate_in_pull_requests:
 
      <li>
 
        <div style="height: 12px">
 
        %if pull_request.is_closed():
 
            <img src="${h.url('/images/icons/lock_go.png')}" title="${_('Closed')}"/>
 
        %endif
 
        <img src="${h.url('/images/icons/flag_status_%s.png' % str(pull_request.last_review_status))}" />          
 
        <a href="${h.url('pullrequest_show',repo_name=pull_request.other_repo.repo_name,pull_request_id=pull_request.pull_request_id)}">
 
        ${_('Pull request #%s opened by %s on %s') % (pull_request.pull_request_id, pull_request.author.full_name, h.fmt_date(pull_request.created_on))}
 
        </a>
 
      </div>
 
      </li>
 
      %endfor
0 comments (0 inline, 0 general)