Merge pull request #5089 from dnaf/m-heroes-empty-room-name
Make /sync return heroes if room name or canonical alias are empty
This commit is contained in:
commit
8f06344e11
|
@ -0,0 +1 @@
|
||||||
|
Fixes client-server API not sending "m.heroes" to lazy-load /sync requests when a rooms name or its canonical alias are empty. Thanks to @dnaf for this work!
|
|
@ -583,19 +583,18 @@ class SyncHandler(object):
|
||||||
)
|
)
|
||||||
|
|
||||||
# if the room has a name or canonical_alias set, we can skip
|
# if the room has a name or canonical_alias set, we can skip
|
||||||
# calculating heroes. we assume that if the event has contents, it'll
|
# calculating heroes. Empty strings are falsey, so we check
|
||||||
# be a valid name or canonical_alias - i.e. we're checking that they
|
# for the "name" value and default to an empty string.
|
||||||
# haven't been "deleted" by blatting {} over the top.
|
|
||||||
if name_id:
|
if name_id:
|
||||||
name = yield self.store.get_event(name_id, allow_none=True)
|
name = yield self.store.get_event(name_id, allow_none=True)
|
||||||
if name and name.content:
|
if name and name.content.get("name"):
|
||||||
defer.returnValue(summary)
|
defer.returnValue(summary)
|
||||||
|
|
||||||
if canonical_alias_id:
|
if canonical_alias_id:
|
||||||
canonical_alias = yield self.store.get_event(
|
canonical_alias = yield self.store.get_event(
|
||||||
canonical_alias_id, allow_none=True,
|
canonical_alias_id, allow_none=True,
|
||||||
)
|
)
|
||||||
if canonical_alias and canonical_alias.content:
|
if canonical_alias and canonical_alias.content.get("alias"):
|
||||||
defer.returnValue(summary)
|
defer.returnValue(summary)
|
||||||
|
|
||||||
me = sync_config.user.to_string()
|
me = sync_config.user.to_string()
|
||||||
|
|
Loading…
Reference in New Issue