Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #5089 from dnaf/m-heroes-empty-room-name
Browse files Browse the repository at this point in the history
Make /sync return heroes if room name or canonical alias are empty
  • Loading branch information
babolivier authored Jun 6, 2019
2 parents cb3b381 + 7898a1a commit 8f06344
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions changelog.d/5089.bugfix
Original file line number Diff line number Diff line change
@@ -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!
9 changes: 4 additions & 5 deletions synapse/handlers/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,19 +583,18 @@ def compute_summary(self, room_id, sync_config, batch, state, now_token):
)

# 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
# be a valid name or canonical_alias - i.e. we're checking that they
# haven't been "deleted" by blatting {} over the top.
# calculating heroes. Empty strings are falsey, so we check
# for the "name" value and default to an empty string.
if name_id:
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)

if canonical_alias_id:
canonical_alias = yield self.store.get_event(
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)

me = sync_config.user.to_string()
Expand Down

0 comments on commit 8f06344

Please sign in to comment.