Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #5902 from matrix-org/hs/exempt-support-users-from…
Browse files Browse the repository at this point in the history
…-consent
  • Loading branch information
anoadragon453 committed Feb 24, 2020
2 parents 122d08b + c8fa620 commit 3d5f1eb
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.d/5902.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Users with the type of "support" or "bot" are no longer required to consent.
3 changes: 2 additions & 1 deletion synapse/api/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ class UserTypes(object):
"""

SUPPORT = "support"
ALL_USER_TYPES = (SUPPORT,)
BOT = "bot"
ALL_USER_TYPES = (SUPPORT, BOT)


class RelationTypes(object):
Expand Down
5 changes: 4 additions & 1 deletion synapse/handlers/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions synapse/storage/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions tests/storage/test_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
)
Expand Down

0 comments on commit 3d5f1eb

Please sign in to comment.