comparison rhodecode/model/comment.py @ 1717:7ff304d3028f beta

Notification fixes - email prefix added to .ini files - html templates emails - rewrote email system to use some parts from pyramid_mailer
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 25 Nov 2011 17:41:42 +0200
parents 7d1fc253549e
children 48d4fcf04a29
comparison
equal deleted inserted replaced
1716:7d1fc253549e 1717:7ff304d3028f
85 line = _('on line %s') % line_no 85 line = _('on line %s') % line_no
86 subj = h.link_to('Re commit: %(commit_desc)s %(line)s' % \ 86 subj = h.link_to('Re commit: %(commit_desc)s %(line)s' % \
87 {'commit_desc':desc, 'line':line}, 87 {'commit_desc':desc, 'line':line},
88 h.url('changeset_home', repo_name=repo.repo_name, 88 h.url('changeset_home', repo_name=repo.repo_name,
89 revision=revision, 89 revision=revision,
90 anchor='comment-%s' % comment.comment_id 90 anchor='comment-%s' % comment.comment_id,
91 qualified=True,
91 ) 92 )
92 ) 93 )
93 body = text 94 body = text
94 recipients = ChangesetComment.get_users(revision=revision) 95 recipients = ChangesetComment.get_users(revision=revision)
95 # add changeset author 96 # add changeset author
97 98
98 NotificationModel().create(created_by=user_id, subject=subj, 99 NotificationModel().create(created_by=user_id, subject=subj,
99 body=body, recipients=recipients, 100 body=body, recipients=recipients,
100 type_=Notification.TYPE_CHANGESET_COMMENT) 101 type_=Notification.TYPE_CHANGESET_COMMENT)
101 102
102 mention_recipients = set(self._extract_mentions(body)).difference(recipients) 103 mention_recipients = set(self._extract_mentions(body))\
104 .difference(recipients)
103 if mention_recipients: 105 if mention_recipients:
104 subj = _('[Mention]') + ' ' + subj 106 subj = _('[Mention]') + ' ' + subj
105 NotificationModel().create(created_by=user_id, subject=subj, 107 NotificationModel().create(created_by=user_id, subject=subj,
106 body = body, recipients = mention_recipients, 108 body=body,
109 recipients=mention_recipients,
107 type_=Notification.TYPE_CHANGESET_COMMENT) 110 type_=Notification.TYPE_CHANGESET_COMMENT)
108 111
109 self.sa.commit() 112 self.sa.commit()
110 return comment 113 return comment
111 114