Store nothing instead of ['dont_notify'] for events with no notification required: much as it would be nice to be able to tell between the event not having been processed and there being no notification for it, this isn't worth filling up the table with ['dont_notify'] I think. Consequently treat the empty actions array as dont_notify and filter dont_notify out of the result.

This commit is contained in:
David Baker 2015-12-10 18:40:28 +00:00
parent aa667ee396
commit 5e909c73d7
3 changed files with 14 additions and 21 deletions

View file

@ -35,7 +35,6 @@ class ActionGenerator:
@defer.inlineCallbacks
def handle_event(self, event):
users = yield self.store.get_users_in_room(event['room_id'])
logger.error("users in room: %r", users)
for uid in users:
evaluator = yield push_rule_evaluator.\
@ -44,6 +43,7 @@ class ActionGenerator:
)
actions = yield evaluator.actions_for_event(event)
logger.info("actions for user %s: %s", uid, actions)
self.store.set_actions_for_event(
event['event_id'], uid, None, actions
)
if len(actions):
self.store.set_actions_for_event(
event['event_id'], uid, None, actions
)