summary refs log tree commit diff
path: root/synapse/storage/databases
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2020-12-16 08:46:37 -0500
committerGitHub <noreply@github.com>2020-12-16 08:46:37 -0500
commitbe2db93b3c14396d53d30f8d5f92db014453487b (patch)
tree45d487763583c8791da8f62f9e9949f72ee21edb /synapse/storage/databases
parentPreparatory refactoring of the SamlHandlerTestCase (#8938) (diff)
downloadsynapse-be2db93b3c14396d53d30f8d5f92db014453487b.tar.xz
Do not assume that the contents dictionary includes history_visibility. (#8945)
Diffstat (limited to 'synapse/storage/databases')
-rw-r--r--synapse/storage/databases/main/user_directory.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/synapse/storage/databases/main/user_directory.py b/synapse/storage/databases/main/user_directory.py
index d87ceec6da..fc8caf46a0 100644
--- a/synapse/storage/databases/main/user_directory.py
+++ b/synapse/storage/databases/main/user_directory.py
@@ -17,7 +17,7 @@ import logging
 import re
 from typing import Any, Dict, Iterable, Optional, Set, Tuple
 
-from synapse.api.constants import EventTypes, JoinRules
+from synapse.api.constants import EventTypes, HistoryVisibility, JoinRules
 from synapse.storage.database import DatabasePool
 from synapse.storage.databases.main.state import StateFilter
 from synapse.storage.databases.main.state_deltas import StateDeltasStore
@@ -360,7 +360,10 @@ class UserDirectoryBackgroundUpdateStore(StateDeltasStore):
         if hist_vis_id:
             hist_vis_ev = await self.get_event(hist_vis_id, allow_none=True)
             if hist_vis_ev:
-                if hist_vis_ev.content.get("history_visibility") == "world_readable":
+                if (
+                    hist_vis_ev.content.get("history_visibility")
+                    == HistoryVisibility.WORLD_READABLE
+                ):
                     return True
 
         return False