|
a/Allura/allura/model/notification.py |
|
b/Allura/allura/model/notification.py |
|
... |
|
... |
14 |
- Clear subscription's notification list
|
14 |
- Clear subscription's notification list
|
15 |
|
15 |
|
16 |
Notifications are also available for use in feeds
|
16 |
Notifications are also available for use in feeds
|
17 |
'''
|
17 |
'''
|
18 |
|
18 |
|
|
|
19 |
import logging
|
19 |
from datetime import datetime, timedelta
|
20 |
from datetime import datetime, timedelta
|
20 |
from collections import defaultdict
|
21 |
from collections import defaultdict
|
21 |
|
22 |
|
22 |
from pylons import c, g
|
23 |
from pylons import c, g
|
23 |
from tg import config
|
24 |
from tg import config
|
|
... |
|
... |
28 |
|
29 |
|
29 |
from allura.lib import helpers as h
|
30 |
from allura.lib import helpers as h
|
30 |
|
31 |
|
31 |
from .session import main_orm_session, project_orm_session
|
32 |
from .session import main_orm_session, project_orm_session
|
32 |
from .types import ArtifactReferenceType
|
33 |
from .types import ArtifactReferenceType
|
|
|
34 |
|
|
|
35 |
|
|
|
36 |
log = logging.getLogger(__name__)
|
33 |
|
37 |
|
34 |
MAILBOX_QUIESCENT=timedelta(minutes=10)
|
38 |
MAILBOX_QUIESCENT=timedelta(minutes=10)
|
35 |
|
39 |
|
36 |
class Notification(MappedClass):
|
40 |
class Notification(MappedClass):
|
37 |
class __mongometa__:
|
41 |
class __mongometa__:
|
|
... |
|
... |
238 |
if artifact is None:
|
242 |
if artifact is None:
|
239 |
artifact_title = 'All artifacts'
|
243 |
artifact_title = 'All artifacts'
|
240 |
artifact_url = None
|
244 |
artifact_url = None
|
241 |
artifact_index_id = None
|
245 |
artifact_index_id = None
|
242 |
else:
|
246 |
else:
|
|
|
247 |
i = artifact.index()
|
|
|
248 |
artifact_title = i['title_s']
|
|
|
249 |
artifact_url = artifact.url()
|
|
|
250 |
artifact_index_id = i['id']
|
243 |
if cls.query.get(
|
251 |
if cls.query.get(
|
244 |
user_id=user_id, project_id=project_id, app_config_id=app_config_id,
|
252 |
user_id=user_id, project_id=project_id, app_config_id=app_config_id,
|
245 |
artifact_index_id=None):
|
253 |
artifact_index_id=None):
|
246 |
# don't subscribe to individual artifacts when already
|
254 |
# don't subscribe to individual artifacts when already
|
247 |
# subscribed to tool
|
255 |
# subscribed to tool
|
|
|
256 |
log.warning('Tried to subscribe to artifact %s, while there is a tool subscription', artifact_url)
|
248 |
return
|
257 |
return
|
249 |
i = artifact.index()
|
|
|
250 |
artifact_title = i['title_s']
|
|
|
251 |
artifact_url = artifact.url()
|
|
|
252 |
artifact_index_id = i['id']
|
|
|
253 |
d = dict(user_id=user_id, project_id=project_id, app_config_id=app_config_id,
|
258 |
d = dict(user_id=user_id, project_id=project_id, app_config_id=app_config_id,
|
254 |
artifact_index_id=artifact_index_id, topic=topic)
|
259 |
artifact_index_id=artifact_index_id, topic=topic)
|
255 |
sess = session(cls)
|
260 |
sess = session(cls)
|
256 |
try:
|
261 |
try:
|
257 |
mbox = cls(
|
262 |
mbox = cls(
|