diff --git a/docs/changelog.rst b/docs/changelog.rst --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -18,15 +18,17 @@ news empty data - modified_on column saves repository update and it's going to be used later for light version of main page ref #500 +- pull request notifications send much nicer emails with details about pull + request fixes +++++ - fixed migrations of permissions that can lead to inconsistency. - Some users sent feedback that after upgrading from older versions issues with updating - default permissions occured. RhodeCode detects that now and resets default user - permission to initial state if there is a need for that. Also forces users to set - the default value for new forking permission. + Some users sent feedback that after upgrading from older versions issues + with updating default permissions occurred. RhodeCode detects that now and + resets default user permission to initial state if there is a need for that. + Also forces users to set the default value for new forking permission. 1.4.0 (**2012-09-03**) diff --git a/rhodecode/model/notification.py b/rhodecode/model/notification.py --- a/rhodecode/model/notification.py +++ b/rhodecode/model/notification.py @@ -255,7 +255,8 @@ class EmailNotificationModel(BaseModel): self.TYPE_CHANGESET_COMMENT: 'email_templates/changeset_comment.html', self.TYPE_PASSWORD_RESET: 'email_templates/password_reset.html', self.TYPE_REGISTRATION: 'email_templates/registration.html', - self.TYPE_DEFAULT: 'email_templates/default.html' + self.TYPE_DEFAULT: 'email_templates/default.html', + self.TYPE_PULL_REQUEST: 'email_templates/pull_request.html', } def get_email_tmpl(self, type_, **kwargs): 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 @@ -79,22 +79,30 @@ class PullRequestModel(BaseModel): #notification to reviewers notif = NotificationModel() + pr_url = h.url('pullrequest_show', repo_name=other_repo.repo_name, + pull_request_id=new.pull_request_id, + qualified=True, + ) subject = safe_unicode( h.link_to( _('%(user)s wants you to review pull request #%(pr_id)s') % \ {'user': created_by_user.username, 'pr_id': new.pull_request_id}, - h.url('pullrequest_show', repo_name=other_repo.repo_name, - pull_request_id=new.pull_request_id, - qualified=True, - ) + pr_url ) ) body = description + kwargs = { + 'pr_title': title, + '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,) - + type_=Notification.TYPE_PULL_REQUEST, email_kwargs=kwargs) return new def update_reviewers(self, pull_request, reviewers_ids): diff --git a/rhodecode/templates/email_templates/pull_request.html b/rhodecode/templates/email_templates/pull_request.html new file mode 100644 --- /dev/null +++ b/rhodecode/templates/email_templates/pull_request.html @@ -0,0 +1,20 @@ +## -*- coding: utf-8 -*- +<%inherit file="main.html"/> + +User ${pr_user_created} opened pull request for repository +${pr_repo_url} and wants you to review changes. + +
title: ${pr_title}
+
description:
+

+${body} +

+ +
revisions for reviewing
+ + +View this pull request here: ${pr_url}