changeset 8561:5fe492c6d7d7

comments: add changeset author in mail notification subject In analogy to the handling of comments on pull requests, as changed in commit d4061c6cc0e2.
author Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
date Sun, 22 Mar 2020 00:00:44 +0100
parents f79c40759d6f
children f79dff927ab9
files kallithea/model/comment.py kallithea/model/notification.py kallithea/tests/models/test_dump_html_mails.ref.html kallithea/tests/models/test_notifications.py
diffstat 4 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/model/comment.py	Tue Jan 23 13:31:25 2018 +0100
+++ b/kallithea/model/comment.py	Sun Mar 22 00:00:44 2020 +0100
@@ -105,6 +105,7 @@
                 'message': cs.message,
                 'message_short': h.shorter(cs.message, 50, firstline=True),
                 'cs_author': cs_author,
+                'cs_author_username': cs_author.username,
                 'repo_name': repo.repo_name,
                 'short_id': h.short_id(revision),
                 'branch': cs.branch,
--- a/kallithea/model/notification.py	Tue Jan 23 13:31:25 2018 +0100
+++ b/kallithea/model/notification.py	Sun Mar 22 00:00:44 2020 +0100
@@ -165,7 +165,7 @@
             self.TYPE_PULL_REQUEST_COMMENT: 'pull_request_comment',
         }
         self._subj_map = {
-            self.TYPE_CHANGESET_COMMENT: _('[Comment] %(repo_name)s changeset %(short_id)s "%(message_short)s" on %(branch)s'),
+            self.TYPE_CHANGESET_COMMENT: _('[Comment] %(repo_name)s changeset %(short_id)s "%(message_short)s" on %(branch)s by %(cs_author_username)s'),
             self.TYPE_MESSAGE: 'Test Message',
             # self.TYPE_PASSWORD_RESET
             self.TYPE_REGISTRATION: _('New user %(new_username)s registered'),
--- a/kallithea/tests/models/test_dump_html_mails.ref.html	Tue Jan 23 13:31:25 2018 +0100
+++ b/kallithea/tests/models/test_dump_html_mails.ref.html	Sun Mar 22 00:00:44 2020 +0100
@@ -7,7 +7,7 @@
 <pre>
 From: u1 u1 <name@example.com>
 To: u2@example.com
-Subject: [Comment] repo/name changeset cafe1234 "This changeset did something cl..." on brunch
+Subject: [Comment] repo/name changeset cafe1234 "This changeset did something cl..." on brunch by u2
 </pre>
 <hr/>
 <pre>http://comment.org
@@ -166,7 +166,7 @@
 <pre>
 From: u1 u1 <name@example.com>
 To: u2@example.com
-Subject: [Comment] repo/name changeset cafe1234 "This changeset did something cl..." on brunch
+Subject: [Comment] repo/name changeset cafe1234 "This changeset did something cl..." on brunch by u2
 </pre>
 <hr/>
 <pre>http://comment.org
@@ -325,7 +325,7 @@
 <pre>
 From: u1 u1 <name@example.com>
 To: u2@example.com
-Subject: [Approved: Comment] repo/name changeset cafe1234 "This changeset did something cl..." on brunch
+Subject: [Approved: Comment] repo/name changeset cafe1234 "This changeset did something cl..." on brunch by u2
 </pre>
 <hr/>
 <pre>http://comment.org
@@ -502,7 +502,7 @@
 <pre>
 From: u1 u1 <name@example.com>
 To: u2@example.com
-Subject: [Approved: Comment] repo/name changeset cafe1234 "This changeset did something cl..." on brunch
+Subject: [Approved: Comment] repo/name changeset cafe1234 "This changeset did something cl..." on brunch by u2
 </pre>
 <hr/>
 <pre>http://comment.org
--- a/kallithea/tests/models/test_notifications.py	Tue Jan 23 13:31:25 2018 +0100
+++ b/kallithea/tests/models/test_notifications.py	Sun Mar 22 00:00:44 2020 +0100
@@ -103,6 +103,7 @@
                             status_change=[None, 'Approved'],
                             cs_target_repo='http://example.com/repo_target',
                             cs_url='http://changeset.com',
+                            cs_author_username=User.get(self.u2).username,
                             cs_author=User.get(self.u2))),
                         (NotificationModel.TYPE_MESSAGE,
                          'This is the \'body\' of the "test" message\n - nothing interesting here except indentation.',