Changeset - 09757b15ce7c
[Not reviewed]
beta
0 1 0
Mads Kiilerich - 13 years ago 2013-01-29 03:21:21
madski@unity3d.com
notification: don't expand %(when)s in usernames
1 file changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
rhodecode/model/notification.py
Show inline comments
 
@@ -213,51 +213,51 @@ class NotificationModel(BaseModel):
 
        """
 
        Creates a human readable description based on properties
 
        of notification object
 
        """
 
        #alias
 
        _n = notification
 
        _map = {
 
            _n.TYPE_CHANGESET_COMMENT: _('commented on commit at %(when)s'),
 
            _n.TYPE_MESSAGE: _('sent message at %(when)s'),
 
            _n.TYPE_MENTION: _('mentioned you at %(when)s'),
 
            _n.TYPE_REGISTRATION: _('registered in RhodeCode at %(when)s'),
 
            _n.TYPE_PULL_REQUEST: _('opened new pull request at %(when)s'),
 
            _n.TYPE_PULL_REQUEST_COMMENT: _('commented on pull request at %(when)s')
 
        }
 

	
 
        # action == _map string
 
        tmpl = "%(user)s %(action)s "
 
        if show_age:
 
            when = h.age(notification.created_on)
 
        else:
 
            when = h.fmt_date(notification.created_on)
 

	
 
        data = dict(
 
            user=notification.created_by_user.username,
 
            action=_map[notification.type_]
 
            action=_map[notification.type_] % {'when': when},
 
        )
 
        return (tmpl % data) % {'when': when}
 
        return tmpl % data
 

	
 

	
 
class EmailNotificationModel(BaseModel):
 

	
 
    TYPE_CHANGESET_COMMENT = Notification.TYPE_CHANGESET_COMMENT
 
    TYPE_PASSWORD_RESET = 'passoword_link'
 
    TYPE_REGISTRATION = Notification.TYPE_REGISTRATION
 
    TYPE_PULL_REQUEST = Notification.TYPE_PULL_REQUEST
 
    TYPE_PULL_REQUEST_COMMENT = Notification.TYPE_PULL_REQUEST_COMMENT
 
    TYPE_DEFAULT = 'default'
 

	
 
    def __init__(self):
 
        self._template_root = rhodecode.CONFIG['pylons.paths']['templates'][0]
 
        self._tmpl_lookup = rhodecode.CONFIG['pylons.app_globals'].mako_lookup
 

	
 
        self.email_types = {
 
         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_PULL_REQUEST: 'email_templates/pull_request.html',
 
         self.TYPE_PULL_REQUEST_COMMENT: 'email_templates/pull_request_comment.html',
 
        }
 

	
0 comments (0 inline, 0 general)