construct notification handler
parent
87da5ae50e
commit
f25f3c81ee
|
@ -238,3 +238,30 @@ def handle_wishlist_added(supporter, work, **kwargs):
|
|||
emit_notifications.delay()
|
||||
|
||||
wishlist_added.connect(handle_wishlist_added)
|
||||
|
||||
deadline_impending = Signal(providing_args["campaign"])
|
||||
|
||||
def handle_wishlist_near_deadline(campaign, **kwargs):
|
||||
"""
|
||||
send two groups - one the nonpledgers, one the pledgers
|
||||
set the pledged flag differently in the context
|
||||
"""
|
||||
pledgers = campaign.supporters()
|
||||
nonpledgers = campaign.work.wished_by().exclude(id__in=pledgers)
|
||||
|
||||
notification.queue(pledgers, "wishlist_near_deadline", {
|
||||
'campaign': campaign,
|
||||
'domain': settings.BASE_URL,
|
||||
'pledged': True,
|
||||
}, True)
|
||||
|
||||
notification.queue(nonpledgers, "wishlist_near_deadline", {
|
||||
'campaign': campaign,
|
||||
'domain': settings.BASE_URL,
|
||||
'pledged': False,
|
||||
}, True)
|
||||
|
||||
from regluit.core.tasks import emit_notifications
|
||||
emit_notifications.delay()
|
||||
|
||||
deadline_impending.connect(handle_wishlist_near_deadline)
|
Loading…
Reference in New Issue