|
|
|
@ -21,11 +21,11 @@ def monkeyPatchPushRules(store):
|
|
|
|
|
otherwise event_push_actions will get filled up with unread
|
|
|
|
|
notification for pp_ users, creating and infinite growing database
|
|
|
|
|
"""
|
|
|
|
|
originalFunction = BulkPushRuleEvaluator.action_for_event_by_user
|
|
|
|
|
originalFunction = BulkPushRuleEvaluator._action_for_event_by_user
|
|
|
|
|
# cache for whether room is bridge room that gets notifications blocked or not
|
|
|
|
|
room_block_notif = {}
|
|
|
|
|
|
|
|
|
|
async def monkeyPatch(self, event, context):
|
|
|
|
|
async def monkeyPatch(self, event, context, event_id_to_event):
|
|
|
|
|
# always notify on invites
|
|
|
|
|
if event.type != EventTypes.Member or event.membership != Membership.INVITE:
|
|
|
|
|
room_id = event.room_id
|
|
|
|
@ -39,9 +39,9 @@ def monkeyPatchPushRules(store):
|
|
|
|
|
room_block_notif[room_id] = True
|
|
|
|
|
return
|
|
|
|
|
room_block_notif[room_id] = False
|
|
|
|
|
return await originalFunction(self, event, context)
|
|
|
|
|
return await originalFunction(self, event, context, event_id_to_event)
|
|
|
|
|
|
|
|
|
|
BulkPushRuleEvaluator.action_for_event_by_user = monkeyPatch
|
|
|
|
|
BulkPushRuleEvaluator._action_for_event_by_user = monkeyPatch
|
|
|
|
|
logger.info('Monkey patched BulkPushRuleEvaluator')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|