summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@arasphere.net>2018-09-12 17:11:05 +0100
committerGitHub <noreply@github.com>2018-09-12 17:11:05 +0100
commit2ac1abbc7e8647548ae2e32119cb2bd3b173d9bd (patch)
tree562ace470a9992575c351d6ed462efa53c42b30d
parentMerge pull request #3853 from matrix-org/erikj/log_outbound_each_time (diff)
downloadsynapse-2ac1abbc7e8647548ae2e32119cb2bd3b173d9bd.tar.xz
show heroes if a room has a 'deleted' name/canonical_alias (#3851)
Diffstat (limited to '')
-rw-r--r--changelog.d/3851.bugfix1
-rw-r--r--synapse/handlers/sync.py17
2 files changed, 16 insertions, 2 deletions
diff --git a/changelog.d/3851.bugfix b/changelog.d/3851.bugfix
new file mode 100644
index 0000000000..b53a9efe7b
--- /dev/null
+++ b/changelog.d/3851.bugfix
@@ -0,0 +1 @@
+Show heroes if room name/canonical alias has been deleted
diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py
index 45a1dd5952..9bca4e7067 100644
--- a/synapse/handlers/sync.py
+++ b/synapse/handlers/sync.py
@@ -562,8 +562,21 @@ class SyncHandler(object):
             details.get(Membership.INVITE, empty_ms).count
         )
 
-        if name_id or canonical_alias_id:
-            defer.returnValue(summary)
+        # 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.
+        if name_id:
+            name = yield self.store.get_event(name_id, allow_none=False)
+            if name and name.content:
+                defer.returnValue(summary)
+
+        if canonical_alias_id:
+            canonical_alias = yield self.store.get_event(
+                canonical_alias_id, allow_none=False,
+            )
+            if canonical_alias and canonical_alias.content:
+                defer.returnValue(summary)
 
         joined_user_ids = [
             r[0] for r in details.get(Membership.JOIN, empty_ms).members