diff --git a/rhodecode/controllers/admin/settings.py b/rhodecode/controllers/admin/settings.py --- a/rhodecode/controllers/admin/settings.py +++ b/rhodecode/controllers/admin/settings.py @@ -477,12 +477,16 @@ class SettingsController(BaseController) 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() diff --git a/rhodecode/model/pull_request.py b/rhodecode/model/pull_request.py --- a/rhodecode/model/pull_request.py +++ b/rhodecode/model/pull_request.py @@ -55,7 +55,7 @@ class PullRequestModel(BaseModel): 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, @@ -78,7 +78,7 @@ class PullRequestModel(BaseModel): 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) @@ -116,6 +116,7 @@ class PullRequestModel(BaseModel): '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) diff --git a/rhodecode/templates/admin/users/user_edit_my_account_pullrequests.html b/rhodecode/templates/admin/users/user_edit_my_account_pullrequests.html --- a/rhodecode/templates/admin/users/user_edit_my_account_pullrequests.html +++ b/rhodecode/templates/admin/users/user_edit_my_account_pullrequests.html @@ -6,6 +6,10 @@