# HG changeset patch # User Mads Kiilerich # Date 1469716469 -7200 # Node ID d4061c6cc0e2c36ac720a64733f7a999c32e9e0a # Parent bd5d70b6f445d4c32286de501018dbc6f1e8a957 notifications: tweak PR mail subject lines The subject line is used for mail threading in gmail and can thus not be changed without impacting users ... but now we do it. * The tag '[Review]' is more spot-on than '[Added]'. * The subject should be short so it fits on one line, so abbreviate "pull request" to PR. * Add the PR owner - convenient for filtering comments on own PRs from comments on other PRs. diff -r bd5d70b6f445 -r d4061c6cc0e2 kallithea/model/comment.py --- a/kallithea/model/comment.py Thu Jul 09 22:17:26 2015 +0200 +++ b/kallithea/model/comment.py Thu Jul 28 16:34:29 2016 +0200 @@ -153,6 +153,7 @@ repo_name=pull_request.org_repo.repo_name), 'pr_source_branch': org_ref_name, 'pr_owner': pull_request.owner, + 'pr_owner_username': pull_request.owner.username, 'repo_name': pull_request.other_repo.repo_name, 'comment_username': user.username, 'threading': threading, diff -r bd5d70b6f445 -r d4061c6cc0e2 kallithea/model/notification.py --- a/kallithea/model/notification.py Thu Jul 09 22:17:26 2015 +0200 +++ b/kallithea/model/notification.py Thu Jul 28 16:34:29 2016 +0200 @@ -304,8 +304,8 @@ # self.TYPE_PASSWORD_RESET self.TYPE_REGISTRATION: _('New user %(new_username)s registered'), # self.TYPE_DEFAULT - self.TYPE_PULL_REQUEST: _('[Added] %(repo_name)s pull request %(pr_nice_id)s "%(pr_title_short)s" from %(pr_source_branch)s'), - self.TYPE_PULL_REQUEST_COMMENT: _('[Comment] %(repo_name)s pull request %(pr_nice_id)s "%(pr_title_short)s" from %(pr_source_branch)s'), + self.TYPE_PULL_REQUEST: _('[Review] %(repo_name)s PR %(pr_nice_id)s "%(pr_title_short)s" from %(pr_source_branch)s by %(pr_owner_username)s'), + self.TYPE_PULL_REQUEST_COMMENT: _('[Comment] %(repo_name)s PR %(pr_nice_id)s "%(pr_title_short)s" from %(pr_source_branch)s by %(pr_owner_username)s'), } def get_email_description(self, type_, **kwargs): diff -r bd5d70b6f445 -r d4061c6cc0e2 kallithea/model/pull_request.py --- a/kallithea/model/pull_request.py Thu Jul 09 22:17:26 2015 +0200 +++ b/kallithea/model/pull_request.py Thu Jul 28 16:34:29 2016 +0200 @@ -171,6 +171,7 @@ repo_name=pr.org_repo.repo_name), 'pr_source_branch': org_ref_name, 'pr_owner': pr.owner, + 'pr_owner_username': pr.owner.username, 'pr_username': user.username, 'threading': threading, 'is_mention': False, diff -r bd5d70b6f445 -r d4061c6cc0e2 kallithea/tests/models/test_dump_html_mails.ref.html --- a/kallithea/tests/models/test_dump_html_mails.ref.html Thu Jul 09 22:17:26 2015 +0200 +++ b/kallithea/tests/models/test_dump_html_mails.ref.html Thu Jul 28 16:34:29 2016 +0200 @@ -286,7 +286,7 @@ From: u1 To: u2@example.com -Subject: [Added] repo/name pull request #7 "The Title" from devbranch +Subject: [Review] repo/name PR #7 "The Title" from devbranch by u2 -------------------- @@ -351,7 +351,7 @@ From: u1 To: u2@example.com -Subject: [Added] repo/name pull request #7 "The Title" from devbranch +Subject: [Review] repo/name PR #7 "The Title" from devbranch by u2 -------------------- @@ -416,7 +416,7 @@ From: u1 To: u2@example.com -Subject: [Comment] repo/name pull request #7 "The Title" from devbranch +Subject: [Comment] repo/name PR #7 "The Title" from devbranch by u2 -------------------- @@ -459,7 +459,7 @@ From: u1 To: u2@example.com -Subject: [Comment] repo/name pull request #7 "The Title" from devbranch +Subject: [Comment] repo/name PR #7 "The Title" from devbranch by u2 -------------------- @@ -502,7 +502,7 @@ From: u1 To: u2@example.com -Subject: [Under Review: Comment] repo/name pull request #7 "The Title" from devbranch +Subject: [Under Review: Comment] repo/name PR #7 "The Title" from devbranch by u2 -------------------- @@ -547,7 +547,7 @@ From: u1 To: u2@example.com -Subject: [Under Review: Comment] repo/name pull request #7 "The Title" from devbranch +Subject: [Under Review: Comment] repo/name PR #7 "The Title" from devbranch by u2 -------------------- @@ -592,7 +592,7 @@ From: u1 To: u2@example.com -Subject: [Closing: Comment] repo/name pull request #7 "The Title" from devbranch +Subject: [Closing: Comment] repo/name PR #7 "The Title" from devbranch by u2 -------------------- @@ -635,7 +635,7 @@ From: u1 To: u2@example.com -Subject: [Closing: Comment] repo/name pull request #7 "The Title" from devbranch +Subject: [Closing: Comment] repo/name PR #7 "The Title" from devbranch by u2 -------------------- @@ -678,7 +678,7 @@ From: u1 To: u2@example.com -Subject: [Under Review, Closing: Comment] repo/name pull request #7 "The Title" from devbranch +Subject: [Under Review, Closing: Comment] repo/name PR #7 "The Title" from devbranch by u2 -------------------- @@ -723,7 +723,7 @@ From: u1 To: u2@example.com -Subject: [Under Review, Closing: Comment] repo/name pull request #7 "The Title" from devbranch +Subject: [Under Review, Closing: Comment] repo/name PR #7 "The Title" from devbranch by u2 -------------------- diff -r bd5d70b6f445 -r d4061c6cc0e2 kallithea/tests/models/test_notifications.py --- a/kallithea/tests/models/test_notifications.py Thu Jul 09 22:17:26 2015 +0200 +++ b/kallithea/tests/models/test_notifications.py Thu Jul 28 16:34:29 2016 +0200 @@ -192,6 +192,7 @@ pr_source_repo='https://dev.org/repo', pr_source_branch='devbranch', pr_owner=User.get(self.u2), + pr_owner_username='u2' ) for type_, body, kwargs in [