Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make /sync return heroes if room name or canonical alias are empty #5089

merged 10 commits into from Jun 6, 2019
@@ -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.
@@ -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, allow_none=True)
if name and name.content:
if name and name.content.get("name", ""):

if canonical_alias_id:
canonical_alias = yield
canonical_alias_id, allow_none=True,
if canonical_alias and canonical_alias.content:
if canonical_alias and canonical_alias.content.get("alias", ""):
This conversation was marked as resolved by babolivier

This comment has been minimized.

Copy link

erikjohnston Jun 6, 2019


You can just write this as canonical_alias.content.get("alias") since it'll default to None which is falsey

This comment has been minimized.

Copy link

joined_user_ids = [
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.