0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-15 20:33:51 +01:00

Merge pull request #2276 from matrix-org/erikj/fix_user_di

Don't assume existence of events when updating user directory
This commit is contained in:
Erik Johnston 2017-06-13 10:55:41 +01:00 committed by GitHub
commit de4cb50ca6

View file

@ -225,7 +225,7 @@ class UserDirectoyHandler(object):
logger.debug("Server is still in room: %r", room_id) logger.debug("Server is still in room: %r", room_id)
if change: # The user joined if change: # The user joined
event = yield self.store.get_event(event_id) event = yield self.store.get_event(event_id, allow_none=True)
profile = ProfileInfo( profile = ProfileInfo(
avatar_url=event.content.get("avatar_url"), avatar_url=event.content.get("avatar_url"),
display_name=event.content.get("displayname"), display_name=event.content.get("displayname"),
@ -379,8 +379,11 @@ class UserDirectoyHandler(object):
if not prev_event_id or not event_id: if not prev_event_id or not event_id:
return return
prev_event = yield self.store.get_event(prev_event_id) prev_event = yield self.store.get_event(prev_event_id, allow_none=True)
event = yield self.store.get_event(event_id) event = yield self.store.get_event(event_id, allow_none=True)
if not prev_event or not event:
return
if event.membership != Membership.JOIN: if event.membership != Membership.JOIN:
return return