summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorBrendan Abolivier <babolivier@matrix.org>2019-06-06 11:18:13 +0100
committerGitHub <noreply@github.com>2019-06-06 11:18:13 +0100
commit8f06344e11027dceb9634a30504aa81e338b580f (patch)
treeb11f172600ec3845f81cae03f4c2d4f08da70cde /synapse
parentMerge pull request #5359 from matrix-org/rav/enable_tls_verification (diff)
parentAdd credit in the changelog (diff)
downloadsynapse-8f06344e11027dceb9634a30504aa81e338b580f.tar.xz
Merge pull request #5089 from dnaf/m-heroes-empty-room-name
Make /sync return heroes if room name or canonical alias are empty
Diffstat (limited to 'synapse')
-rw-r--r--synapse/handlers/sync.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py
index bbf74027ac..62fda0c664 100644
--- a/synapse/handlers/sync.py
+++ b/synapse/handlers/sync.py
@@ -583,19 +583,18 @@ class SyncHandler(object):
         )
 
         # 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()