0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-11-03 13:18:56 +01:00

Support membership events and more camelcase/underscores

This commit is contained in:
David Baker 2015-01-26 17:27:28 +00:00
parent 69a75b7ebe
commit b481889117
2 changed files with 8 additions and 4 deletions

View file

@ -65,6 +65,10 @@ class Pusher(object):
# let's assume you probably know about messages you sent yourself # let's assume you probably know about messages you sent yourself
defer.returnValue(['dont_notify']) defer.returnValue(['dont_notify'])
if ev['type'] == 'm.room.member':
if ev['state_key'] != self.user_name:
defer.returnValue(['dont_notify'])
rules = yield self.store.get_push_rules_for_user_name(self.user_name) rules = yield self.store.get_push_rules_for_user_name(self.user_name)
for r in rules: for r in rules:

View file

@ -65,8 +65,6 @@ class HttpPusher(Pusher):
d = { d = {
'notification': { 'notification': {
'transition': 'new',
# everything is new for now: we don't have read receipts
'id': event['event_id'], 'id': event['event_id'],
'type': event['type'], 'type': event['type'],
'from': event['user_id'], 'from': event['user_id'],
@ -89,11 +87,13 @@ class HttpPusher(Pusher):
] ]
} }
} }
if event['type'] == 'm.room.member':
d['notification']['membership'] = event['content']['membership']
if len(ctx['aliases']): if len(ctx['aliases']):
d['notification']['roomAlias'] = ctx['aliases'][0] d['notification']['room_alias'] = ctx['aliases'][0]
if 'name' in ctx: if 'name' in ctx:
d['notification']['roomName'] = ctx['name'] d['notification']['room_name'] = ctx['name']
defer.returnValue(d) defer.returnValue(d)