|
a/Allura/allura/model/notification.py |
|
b/Allura/allura/model/notification.py |
|
... |
|
... |
116 |
Create a Notification instance based on an artifact. Special handling
|
116 |
Create a Notification instance based on an artifact. Special handling
|
117 |
for comments when topic=='message'
|
117 |
for comments when topic=='message'
|
118 |
'''
|
118 |
'''
|
119 |
|
119 |
|
120 |
from allura.model import Project
|
120 |
from allura.model import Project
|
121 |
idx = artifact.index()
|
121 |
idx = artifact.index() if artifact else None
|
122 |
subject_prefix = '[%s:%s] ' % (
|
122 |
subject_prefix = '[%s:%s] ' % (
|
123 |
c.project.shortname, c.app.config.options.mount_point)
|
123 |
c.project.shortname, c.app.config.options.mount_point)
|
124 |
post = ''
|
124 |
post = ''
|
125 |
if topic == 'message':
|
125 |
if topic == 'message':
|
126 |
post = kwargs.pop('post')
|
126 |
post = kwargs.pop('post')
|
|
... |
|
... |
144 |
subject=subject_prefix + subject,
|
144 |
subject=subject_prefix + subject,
|
145 |
text=text,
|
145 |
text=text,
|
146 |
in_reply_to=post.parent_id,
|
146 |
in_reply_to=post.parent_id,
|
147 |
author_id=author._id,
|
147 |
author_id=author._id,
|
148 |
pubdate=datetime.utcnow())
|
148 |
pubdate=datetime.utcnow())
|
|
|
149 |
elif topic == 'flash':
|
|
|
150 |
n = cls(topic=topic,
|
|
|
151 |
text=kwargs['text'],
|
|
|
152 |
subject=kwargs.pop('subject', ''))
|
|
|
153 |
return n
|
149 |
else:
|
154 |
else:
|
150 |
subject = kwargs.pop('subject', '%s modified by %s' % (
|
155 |
subject = kwargs.pop('subject', '%s modified by %s' % (
|
151 |
idx['title_s'],c.user.get_pref('display_name')))
|
156 |
idx['title_s'],c.user.get_pref('display_name')))
|
152 |
reply_to = '"%s" <%s>' % (
|
157 |
reply_to = '"%s" <%s>' % (
|
153 |
idx['title_s'],
|
158 |
idx['title_s'],
|