|
a/Allura/allura/model/notification.py |
|
b/Allura/allura/model/notification.py |
|
... |
|
... |
441 |
all summary & digest subscriptions with notifications that are ready
|
441 |
all summary & digest subscriptions with notifications that are ready
|
442 |
'''
|
442 |
'''
|
443 |
now = datetime.utcnow()
|
443 |
now = datetime.utcnow()
|
444 |
# Queries to find all matching subscription objects
|
444 |
# Queries to find all matching subscription objects
|
445 |
q_direct = dict(
|
445 |
q_direct = dict(
|
446 |
type='direct')
|
446 |
type='direct',
|
|
|
447 |
queue={'$ne':[]})
|
447 |
if MAILBOX_QUIESCENT:
|
448 |
if MAILBOX_QUIESCENT:
|
448 |
q_direct['last_modified']={'$lt':now - MAILBOX_QUIESCENT}
|
449 |
q_direct['last_modified']={'$lt':now - MAILBOX_QUIESCENT}
|
449 |
q_digest = dict(
|
450 |
q_digest = dict(
|
450 |
type={'$in': ['digest', 'summary']},
|
451 |
type={'$in': ['digest', 'summary']},
|
451 |
next_scheduled={'$lt':now})
|
452 |
next_scheduled={'$lt':now})
|
452 |
for mbox in cls.query.find(q_direct):
|
453 |
for mbox in cls.query.find(q_direct):
|
453 |
if mbox.queue:
|
|
|
454 |
mbox = cls.query.find_and_modify(
|
454 |
mbox = cls.query.find_and_modify(
|
455 |
query=dict(_id=mbox._id),
|
455 |
query=dict(_id=mbox._id),
|
456 |
update={'$set': dict(
|
456 |
update={'$set': dict(
|
457 |
queue=[])},
|
457 |
queue=[])},
|
458 |
new=False)
|
458 |
new=False)
|
459 |
mbox.fire(now)
|
459 |
mbox.fire(now)
|
460 |
for mbox in cls.query.find(q_digest):
|
460 |
for mbox in cls.query.find(q_digest):
|
461 |
next_scheduled = now
|
461 |
next_scheduled = now
|
462 |
if mbox.frequency.unit == 'day':
|
462 |
if mbox.frequency.unit == 'day':
|
463 |
next_scheduled += timedelta(days=mbox.frequency.n)
|
463 |
next_scheduled += timedelta(days=mbox.frequency.n)
|
464 |
elif mbox.frequency.unit == 'week':
|
464 |
elif mbox.frequency.unit == 'week':
|