diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2020-12-16 08:46:37 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-16 08:46:37 -0500 |
commit | be2db93b3c14396d53d30f8d5f92db014453487b (patch) | |
tree | 45d487763583c8791da8f62f9e9949f72ee21edb /synapse/storage/databases | |
parent | Preparatory refactoring of the SamlHandlerTestCase (#8938) (diff) | |
download | synapse-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.py | 7 |
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 |