Show More
@@ -1402,9 +1402,10 b' def _mentions_replace(match_obj):' | |||||
1402 | return '<b>@%s</b>' % match_obj.group(1) |
|
1402 | return '<b>@%s</b>' % match_obj.group(1) | |
1403 |
|
1403 | |||
1404 |
|
1404 | |||
1405 | def render_w_mentions(source): |
|
1405 | def render_w_mentions(source, repo_name=None): | |
1406 | """ |
|
1406 | """ | |
1407 |
Render plain text with |
|
1407 | Render plain text with revision hashes and issue references urlified | |
|
1408 | and with @mention highlighting. | |||
1408 | """ |
|
1409 | """ | |
1409 | s = source.rstrip() |
|
1410 | s = source.rstrip() | |
1410 | s = safe_unicode(s) |
|
1411 | s = safe_unicode(s) | |
@@ -1413,6 +1414,9 b' def render_w_mentions(source):' | |||||
1413 | # this sequence of html-ifications seems to be safe and non-conflicting |
|
1414 | # this sequence of html-ifications seems to be safe and non-conflicting | |
1414 | # if the issues regexp is sane |
|
1415 | # if the issues regexp is sane | |
1415 | s = _urlify_text(s) |
|
1416 | s = _urlify_text(s) | |
|
1417 | if repo_name is not None: | |||
|
1418 | s = urlify_changesets(s, repo_name) | |||
|
1419 | s = urlify_issues(s, repo_name) | |||
1416 | s = MENTIONS_REGEX.sub(_mentions_replace, s) |
|
1420 | s = MENTIONS_REGEX.sub(_mentions_replace, s) | |
1417 | return literal('<code style="white-space:pre-wrap">%s</code>' % s) |
|
1421 | return literal('<code style="white-space:pre-wrap">%s</code>' % s) | |
1418 |
|
1422 |
@@ -59,7 +59,7 b' class NotificationModel(BaseModel):' | |||||
59 |
|
59 | |||
60 | def create(self, created_by, subject, body, recipients=None, |
|
60 | def create(self, created_by, subject, body, recipients=None, | |
61 | type_=Notification.TYPE_MESSAGE, with_email=True, |
|
61 | type_=Notification.TYPE_MESSAGE, with_email=True, | |
62 | email_kwargs=None): |
|
62 | email_kwargs=None, repo_name=None): | |
63 | """ |
|
63 | """ | |
64 |
|
64 | |||
65 | Creates notification of given type |
|
65 | Creates notification of given type | |
@@ -123,7 +123,7 b' class NotificationModel(BaseModel):' | |||||
123 | ## this is passed into template |
|
123 | ## this is passed into template | |
124 | html_kwargs = { |
|
124 | html_kwargs = { | |
125 | 'subject': subject, |
|
125 | 'subject': subject, | |
126 | 'body': h.render_w_mentions(body), |
|
126 | 'body': h.render_w_mentions(body, repo_name), | |
127 | 'when': h.fmt_date(notif.created_on), |
|
127 | 'when': h.fmt_date(notif.created_on), | |
128 | 'user': notif.created_by_user.username, |
|
128 | 'user': notif.created_by_user.username, | |
129 | } |
|
129 | } |
General Comments 0
You need to be logged in to leave comments.
Login now