Change 'from' in notification pokes to 'sender' to match client API v2. Send sender display names where they exist.
parent
1235f7f383
commit
0b16886397
|
@ -154,6 +154,16 @@ class Pusher(object):
|
||||||
if name_aliases[0] is not None:
|
if name_aliases[0] is not None:
|
||||||
ctx['name'] = name_aliases[0]
|
ctx['name'] = name_aliases[0]
|
||||||
|
|
||||||
|
their_member_events_for_room = yield self.store.get_current_state(
|
||||||
|
room_id=ev['room_id'],
|
||||||
|
event_type='m.room.member',
|
||||||
|
state_key=ev['user_id']
|
||||||
|
)
|
||||||
|
if len(their_member_events_for_room) > 0:
|
||||||
|
dn = their_member_events_for_room[0].content['displayname']
|
||||||
|
if dn is not None:
|
||||||
|
ctx['sender_display_name'] = dn
|
||||||
|
|
||||||
defer.returnValue(ctx)
|
defer.returnValue(ctx)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
|
|
|
@ -67,10 +67,7 @@ class HttpPusher(Pusher):
|
||||||
'notification': {
|
'notification': {
|
||||||
'id': event['event_id'],
|
'id': event['event_id'],
|
||||||
'type': event['type'],
|
'type': event['type'],
|
||||||
'from': event['user_id'],
|
'sender': event['user_id'],
|
||||||
# we may have to fetch this over federation and we
|
|
||||||
# can't trust it anyway: is it worth it?
|
|
||||||
#'from_display_name': 'Steve Stevington'
|
|
||||||
'counts': { # -- we don't mark messages as read yet so
|
'counts': { # -- we don't mark messages as read yet so
|
||||||
# we have no way of knowing
|
# we have no way of knowing
|
||||||
# Just set the badge to 1 until we have read receipts
|
# Just set the badge to 1 until we have read receipts
|
||||||
|
@ -93,6 +90,8 @@ class HttpPusher(Pusher):
|
||||||
|
|
||||||
if len(ctx['aliases']):
|
if len(ctx['aliases']):
|
||||||
d['notification']['room_alias'] = ctx['aliases'][0]
|
d['notification']['room_alias'] = ctx['aliases'][0]
|
||||||
|
if 'sender_display_name' in ctx:
|
||||||
|
d['notification']['sender_display_name'] = ctx['sender_display_name']
|
||||||
if 'name' in ctx:
|
if 'name' in ctx:
|
||||||
d['notification']['room_name'] = ctx['name']
|
d['notification']['room_name'] = ctx['name']
|
||||||
|
|
||||||
|
@ -119,7 +118,7 @@ class HttpPusher(Pusher):
|
||||||
'notification': {
|
'notification': {
|
||||||
'id': '',
|
'id': '',
|
||||||
'type': None,
|
'type': None,
|
||||||
'from': '',
|
'sender': '',
|
||||||
'counts': {
|
'counts': {
|
||||||
'unread': 0,
|
'unread': 0,
|
||||||
'missed_calls': 0
|
'missed_calls': 0
|
||||||
|
|
Loading…
Reference in New Issue