diff --git a/changelog.d/5902.feature b/changelog.d/5902.feature new file mode 100644 index 000000000000..0660f65cfabd --- /dev/null +++ b/changelog.d/5902.feature @@ -0,0 +1 @@ +Users with the type of "support" or "bot" are no longer required to consent. \ No newline at end of file diff --git a/synapse/api/constants.py b/synapse/api/constants.py index 3ffde0d7fc83..f29bce560ca9 100644 --- a/synapse/api/constants.py +++ b/synapse/api/constants.py @@ -122,7 +122,8 @@ class UserTypes(object): """ SUPPORT = "support" - ALL_USER_TYPES = (SUPPORT,) + BOT = "bot" + ALL_USER_TYPES = (SUPPORT, BOT) class RelationTypes(object): diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py index a5e23c4caf90..111f7c7e2fb6 100644 --- a/synapse/handlers/message.py +++ b/synapse/handlers/message.py @@ -24,7 +24,7 @@ from twisted.internet.defer import succeed from synapse import event_auth -from synapse.api.constants import EventTypes, Membership, RelationTypes +from synapse.api.constants import EventTypes, Membership, RelationTypes, UserTypes from synapse.api.errors import ( AuthError, Codes, @@ -469,6 +469,9 @@ def assert_accepted_privacy_policy(self, requester): u = yield self.store.get_user_by_id(user_id) assert u is not None + if u["user_type"] in (UserTypes.SUPPORT, UserTypes.BOT): + # support and bot users are not required to consent + return if u["appservice_id"] is not None: # users registered by an appservice are exempt return diff --git a/synapse/storage/registration.py b/synapse/storage/registration.py index 55e4e84d71bd..938fd00717ed 100644 --- a/synapse/storage/registration.py +++ b/synapse/storage/registration.py @@ -56,6 +56,7 @@ def get_user_by_id(self, user_id): "consent_server_notice_sent", "appservice_id", "creation_ts", + "user_type", ], allow_none=True, desc="get_user_by_id", diff --git a/tests/storage/test_registration.py b/tests/storage/test_registration.py index 0253c4ac05b4..4578cc3b6098 100644 --- a/tests/storage/test_registration.py +++ b/tests/storage/test_registration.py @@ -49,6 +49,7 @@ def test_register(self): "consent_server_notice_sent": None, "appservice_id": None, "creation_ts": 1000, + "user_type": None, }, (yield self.store.get_user_by_id(self.user_id)), )