Commits

Marcin Kuzminski  committed 493646d

Nicer email notifications about pull-request

  • Participants
  • Parent commits 091e99b

Comments (0)

Files changed (4)

File docs/changelog.rst

   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**)

File rhodecode/model/notification.py

          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):

File rhodecode/model/pull_request.py

         #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):

File rhodecode/templates/email_templates/pull_request.html

+## -*- coding: utf-8 -*-
+<%inherit file="main.html"/>
+            
+User <b>${pr_user_created}</b> opened pull request for repository 
+${pr_repo_url} and wants you to review changes.
+
+<div>title: ${pr_title}</div>
+<div>description:</div>
+<p>
+${body}
+</p>
+
+<div>revisions for reviewing</div>
+<ul>
+%for r in pr_revisions:
+    <li>${r}</li>
+%endfor
+</ul>
+
+View this pull request here: ${pr_url}