Changeset - 8d45a14d3191
[Not reviewed]
default
0 1 0
Mads Kiilerich - 11 years ago 2015-03-12 15:39:55
madski@unity3d.com
notifications: use stupid mail static-except-[] subjects to please gmail and its broken threading

This gives reasonable threading, both with gmail and proper mail clients, at
the cost of making the email subjects slightly obscure.

Gmail is clueless - also about mail threading, ignoring our References headers
and the wisdom of jwz. Gmail will start a new thread for each subject. The only
way to make all mails related to the same PR belong to the same thread is thus
to let all mails for a PR have the same subject. Gmail will however ignore
content in square brackets at the beginning of the subject so we can put the
interesting parts there.
1 file changed with 7 insertions and 4 deletions:
0 comments (0 inline, 0 general)
kallithea/model/notification.py
Show inline comments
 
@@ -293,13 +293,13 @@ class EmailNotificationModel(BaseModel):
 
            self.TYPE_PULL_REQUEST_COMMENT: 'pull_request_comment',
 
        }
 
        self._subj_map = {
 
            self.TYPE_CHANGESET_COMMENT: _('Comment on %(repo_name)s changeset %(short_id)s on %(branch)s by %(comment_username)s'),
 
            self.TYPE_CHANGESET_COMMENT: _('[Comment from %(comment_username)s] %(repo_name)s changeset %(short_id)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: _('Review request on %(repo_name)s pull request %(pr_nice_id)s from %(ref)s by %(pr_username)s'),
 
            self.TYPE_PULL_REQUEST_COMMENT: _('Comment on %(repo_name)s pull request %(pr_nice_id)s from %(ref)s by %(comment_username)s'),
 
            self.TYPE_PULL_REQUEST: _('[Added by %(pr_username)s] %(repo_name)s pull request %(pr_nice_id)s from %(ref)s'),
 
            self.TYPE_PULL_REQUEST_COMMENT: _('[Comment from %(comment_username)s] %(repo_name)s pull request %(pr_nice_id)s from %(ref)s'),
 
        }
 

	
 
    def get_email_description(self, type_, **kwargs):
 
@@ -314,7 +314,10 @@ class EmailNotificationModel(BaseModel):
 
            raise
 
        l = [safe_unicode(x) for x in [kwargs.get('status_change'), kwargs.get('closing_pr') and _('Closing')] if x]
 
        if l:
 
            subj += ' (%s)' % (', '.join(l))
 
            if subj.startswith('['):
 
                subj = '[' + ', '.join(l) + ': ' + subj[1:]
 
            else:
 
                subj = '[' + ', '.join(l) + '] ' + subj
 
        return subj
 

	
 
    def get_email_tmpl(self, type_, content_type, **kwargs):
0 comments (0 inline, 0 general)