Changeset - bd5d70b6f445
[Not reviewed]
default
0 5 0
Thomas De Schampheleire <thomas.de.schampheleire at gmail.com> - 10 years ago 2015-07-09 22:17:26

email: add relevant title to subject of emails

For comment and pullrequest mails, add changeset/pullrequest title (shortened
to first 50 characters of first line)
5 files changed with 22 insertions and 17 deletions:
0 comments (0 inline, 0 general)
kallithea/model/comment.py
Show inline comments
 
@@ -98,6 +98,7 @@ class ChangesetCommentsModel(BaseModel):
 
                'cs_comment_url': comment_url,
 
                'raw_id': revision,
 
                'message': cs.message,
 
                'message_short': h.shorter(cs.message, 50, firstline=True),
 
                'cs_author': cs_author,
 
                'repo_name': repo.repo_name,
 
                'short_id': h.short_id(revision),
 
@@ -139,6 +140,7 @@ class ChangesetCommentsModel(BaseModel):
 
            #set some variables for email notification
 
            email_kwargs = {
 
                'pr_title': pull_request.title,
 
                'pr_title_short': h.shorter(pull_request.title, 50),
 
                'pr_nice_id': pull_request.nice_id(),
 
                'status_change': status_change,
 
                'closing_pr': closing_pr,
kallithea/model/notification.py
Show inline comments
 
@@ -299,13 +299,13 @@ class EmailNotificationModel(BaseModel):
 
            self.TYPE_PULL_REQUEST_COMMENT: 'pull_request_comment',
 
        }
 
        self._subj_map = {
 
            self.TYPE_CHANGESET_COMMENT: _('[Comment] %(repo_name)s changeset %(short_id)s on %(branch)s'),
 
            self.TYPE_CHANGESET_COMMENT: _('[Comment] %(repo_name)s changeset %(short_id)s "%(message_short)s" on %(branch)s'),
 
            self.TYPE_MESSAGE: 'Test Message',
 
            # 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 from %(pr_source_branch)s'),
 
            self.TYPE_PULL_REQUEST_COMMENT: _('[Comment] %(repo_name)s pull request %(pr_nice_id)s from %(pr_source_branch)s'),
 
            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'),
 
        }
 

	
 
    def get_email_description(self, type_, **kwargs):
kallithea/model/pull_request.py
Show inline comments
 
@@ -156,6 +156,7 @@ class PullRequestModel(BaseModel):
 
        _other_ref_type, other_ref_name, _other_rev = pr.other_ref.split(':')
 
        email_kwargs = {
 
            'pr_title': pr.title,
 
            'pr_title_short': h.shorter(pr.title, 50),
 
            'pr_user_created': user.full_name_and_username,
 
            'pr_repo_url': h.canonical_url('summary_home', repo_name=pr.other_repo.repo_name),
 
            'pr_url': pr_url,
kallithea/tests/models/test_dump_html_mails.ref.html
Show inline comments
 
@@ -6,7 +6,7 @@
 

	
 
From: u1
 
To: u2@example.com
 
Subject: [Comment] repo/name changeset cafe1234 on brunch
 
Subject: [Comment] repo/name changeset cafe1234 "This changeset did something cl..." on brunch
 

	
 
--------------------
 

	
 
@@ -58,7 +58,7 @@ This is an automatic notification. Don&#
 

	
 
From: u1
 
To: u2@example.com
 
Subject: [Comment] repo/name changeset cafe1234 on brunch
 
Subject: [Comment] repo/name changeset cafe1234 "This changeset did something cl..." on brunch
 

	
 
--------------------
 

	
 
@@ -110,7 +110,7 @@ This is an automatic notification. Don&#
 

	
 
From: u1
 
To: u2@example.com
 
Subject: [Approved: Comment] repo/name changeset cafe1234 on brunch
 
Subject: [Approved: Comment] repo/name changeset cafe1234 "This changeset did something cl..." on brunch
 

	
 
--------------------
 

	
 
@@ -164,7 +164,7 @@ This is an automatic notification. Don&#
 

	
 
From: u1
 
To: u2@example.com
 
Subject: [Approved: Comment] repo/name changeset cafe1234 on brunch
 
Subject: [Approved: Comment] repo/name changeset cafe1234 "This changeset did something cl..." on brunch
 

	
 
--------------------
 

	
 
@@ -286,7 +286,7 @@ This is an automatic notification. Don&#
 

	
 
From: u1
 
To: u2@example.com
 
Subject: [Added] repo/name pull request #7 from devbranch
 
Subject: [Added] repo/name pull request #7 "The Title" from devbranch
 

	
 
--------------------
 

	
 
@@ -351,7 +351,7 @@ This is an automatic notification. Don&#
 

	
 
From: u1
 
To: u2@example.com
 
Subject: [Added] repo/name pull request #7 from devbranch
 
Subject: [Added] repo/name pull request #7 "The Title" from devbranch
 

	
 
--------------------
 

	
 
@@ -416,7 +416,7 @@ This is an automatic notification. Don&#
 

	
 
From: u1
 
To: u2@example.com
 
Subject: [Comment] repo/name pull request #7 from devbranch
 
Subject: [Comment] repo/name pull request #7 "The Title" from devbranch
 

	
 
--------------------
 

	
 
@@ -459,7 +459,7 @@ This is an automatic notification. Don&#
 

	
 
From: u1
 
To: u2@example.com
 
Subject: [Comment] repo/name pull request #7 from devbranch
 
Subject: [Comment] repo/name pull request #7 "The Title" from devbranch
 

	
 
--------------------
 

	
 
@@ -502,7 +502,7 @@ This is an automatic notification. Don&#
 

	
 
From: u1
 
To: u2@example.com
 
Subject: [Under Review: Comment] repo/name pull request #7 from devbranch
 
Subject: [Under Review: Comment] repo/name pull request #7 "The Title" from devbranch
 

	
 
--------------------
 

	
 
@@ -547,7 +547,7 @@ This is an automatic notification. Don&#
 

	
 
From: u1
 
To: u2@example.com
 
Subject: [Under Review: Comment] repo/name pull request #7 from devbranch
 
Subject: [Under Review: Comment] repo/name pull request #7 "The Title" from devbranch
 

	
 
--------------------
 

	
 
@@ -592,7 +592,7 @@ This is an automatic notification. Don&#
 

	
 
From: u1
 
To: u2@example.com
 
Subject: [Closing: Comment] repo/name pull request #7 from devbranch
 
Subject: [Closing: Comment] repo/name pull request #7 "The Title" from devbranch
 

	
 
--------------------
 

	
 
@@ -635,7 +635,7 @@ This is an automatic notification. Don&#
 

	
 
From: u1
 
To: u2@example.com
 
Subject: [Closing: Comment] repo/name pull request #7 from devbranch
 
Subject: [Closing: Comment] repo/name pull request #7 "The Title" from devbranch
 

	
 
--------------------
 

	
 
@@ -678,7 +678,7 @@ This is an automatic notification. Don&#
 

	
 
From: u1
 
To: u2@example.com
 
Subject: [Under Review, Closing: Comment] repo/name pull request #7 from devbranch
 
Subject: [Under Review, Closing: Comment] repo/name pull request #7 "The Title" from devbranch
 

	
 
--------------------
 

	
 
@@ -723,7 +723,7 @@ This is an automatic notification. Don&#
 

	
 
From: u1
 
To: u2@example.com
 
Subject: [Under Review, Closing: Comment] repo/name pull request #7 from devbranch
 
Subject: [Under Review, Closing: Comment] repo/name pull request #7 "The Title" from devbranch
 

	
 
--------------------
 

	
kallithea/tests/models/test_notifications.py
Show inline comments
 
@@ -185,6 +185,7 @@ class TestNotifications(TestController):
 
            pr_kwargs = dict(
 
                pr_nice_id='#7',
 
                pr_title='The Title',
 
                pr_title_short='The Title',
 
                pr_url='http://pr.org/7',
 
                pr_target_repo='http://mainline.com/repo',
 
                pr_target_branch='trunk',
 
@@ -204,6 +205,7 @@ class TestNotifications(TestController):
 
                    cs_comment_url='http://comment.org',
 
                    is_mention=[False, True],
 
                    message='This changeset did something clever which is hard to explain',
 
                    message_short='This changeset did something cl...',
 
                    status_change=[None, 'Approved'],
 
                    cs_target_repo='repo_target',
 
                    cs_url='http://changeset.com',
0 comments (0 inline, 0 general)