|
a/Allura/allura/model/notification.py |
|
b/Allura/allura/model/notification.py |
|
... |
|
... |
29 |
|
29 |
|
30 |
from allura.lib import helpers as h
|
30 |
from allura.lib import helpers as h
|
31 |
|
31 |
|
32 |
from .session import main_orm_session, project_orm_session
|
32 |
from .session import main_orm_session, project_orm_session
|
33 |
from .types import ArtifactReferenceType
|
33 |
from .types import ArtifactReferenceType
|
|
|
34 |
from .auth import User
|
34 |
|
35 |
|
35 |
|
36 |
|
36 |
log = logging.getLogger(__name__)
|
37 |
log = logging.getLogger(__name__)
|
37 |
|
38 |
|
38 |
MAILBOX_QUIESCENT=None # Re-enable with [#1384]: timedelta(minutes=10)
|
39 |
MAILBOX_QUIESCENT=None # Re-enable with [#1384]: timedelta(minutes=10)
|
|
... |
|
... |
60 |
author_id=ForeignIdProperty('User')
|
61 |
author_id=ForeignIdProperty('User')
|
61 |
feed_meta=FieldProperty(dict(
|
62 |
feed_meta=FieldProperty(dict(
|
62 |
link=str,
|
63 |
link=str,
|
63 |
created=S.DateTime(if_missing=datetime.utcnow),
|
64 |
created=S.DateTime(if_missing=datetime.utcnow),
|
64 |
unique_id=S.String(if_missing=lambda:h.nonce(40)),
|
65 |
unique_id=S.String(if_missing=lambda:h.nonce(40)),
|
65 |
author_name=S.String(if_missing=lambda:c.user.display_name),
|
66 |
author_name=S.String(if_missing=lambda:c.user.display_name if hasattr(c, 'user') else None),
|
66 |
author_link=S.String(if_missing=lambda:c.user.url())))
|
67 |
author_link=S.String(if_missing=lambda:c.user.url() if hasattr(c, 'user') else None)))
|
67 |
|
68 |
|
68 |
@classmethod
|
69 |
@classmethod
|
69 |
def post(cls, artifact, topic, **kw):
|
70 |
def post(cls, artifact, topic, **kw):
|
70 |
'''Create a notification and send the notify message'''
|
71 |
'''Create a notification and send the notify message'''
|
71 |
n = cls._make_notification(artifact, topic, **kw)
|
72 |
n = cls._make_notification(artifact, topic, **kw)
|
|
... |
|
... |
111 |
subject=subject_prefix + subject,
|
112 |
subject=subject_prefix + subject,
|
112 |
text=post.text,
|
113 |
text=post.text,
|
113 |
in_reply_to=post.parent_id)
|
114 |
in_reply_to=post.parent_id)
|
114 |
else:
|
115 |
else:
|
115 |
subject = kwargs.pop('subject', '%s modified by %s' % (
|
116 |
subject = kwargs.pop('subject', '%s modified by %s' % (
|
116 |
idx['title_s'], c.user.display_name))
|
117 |
idx['title_s'], c.user.display_name if hasattr(c, 'user') else '(unknown user)'))
|
117 |
d = dict(
|
118 |
d = dict(
|
118 |
from_address='%s <%s>' % (
|
119 |
from_address='%s <%s>' % (
|
119 |
idx['title_s'], artifact.email_address),
|
120 |
idx['title_s'], artifact.email_address),
|
120 |
reply_to_address='"%s" <%s>' % (
|
121 |
reply_to_address='"%s" <%s>' % (
|
121 |
idx['title_s'], artifact.email_address),
|
122 |
idx['title_s'], artifact.email_address),
|