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/api | |
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/api')
-rw-r--r-- | synapse/api/auth.py | 5 | ||||
-rw-r--r-- | synapse/api/constants.py | 7 |
2 files changed, 10 insertions, 2 deletions
diff --git a/synapse/api/auth.py b/synapse/api/auth.py index 1951f6e178..48c4d7b0be 100644 --- a/synapse/api/auth.py +++ b/synapse/api/auth.py @@ -23,7 +23,7 @@ from twisted.web.server import Request import synapse.types from synapse import event_auth from synapse.api.auth_blocking import AuthBlocking -from synapse.api.constants import EventTypes, Membership +from synapse.api.constants import EventTypes, HistoryVisibility, Membership from synapse.api.errors import ( AuthError, Codes, @@ -648,7 +648,8 @@ class Auth: ) if ( visibility - and visibility.content["history_visibility"] == "world_readable" + and visibility.content.get("history_visibility") + == HistoryVisibility.WORLD_READABLE ): return Membership.JOIN, None raise AuthError( diff --git a/synapse/api/constants.py b/synapse/api/constants.py index 592abd844b..1932df83b4 100644 --- a/synapse/api/constants.py +++ b/synapse/api/constants.py @@ -160,3 +160,10 @@ class RoomEncryptionAlgorithms: class AccountDataTypes: DIRECT = "m.direct" IGNORED_USER_LIST = "m.ignored_user_list" + + +class HistoryVisibility: + INVITED = "invited" + JOINED = "joined" + SHARED = "shared" + WORLD_READABLE = "world_readable" |