diff options
author | Richard van der Hoff <richard@matrix.org> | 2018-05-22 08:56:52 +0100 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2018-05-22 12:00:47 +0100 |
commit | a5e2941aad9acdd5033709807bb6ddd40e4435eb (patch) | |
tree | 7cce87b9e5550e8d041030a518060e0f2f212614 /synapse/config | |
parent | Merge pull request #3236 from matrix-org/rav/consent_notice (diff) | |
download | synapse-a5e2941aad9acdd5033709807bb6ddd40e4435eb.tar.xz |
Reject attempts to send event before privacy consent is given
Returns an M_CONSENT_NOT_GIVEN error (cf https://github.com/matrix-org/matrix-doc/issues/1252) if consent is not yet given.
Diffstat (limited to 'synapse/config')
-rw-r--r-- | synapse/config/consent_config.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/synapse/config/consent_config.py b/synapse/config/consent_config.py index 8698b2993f..44c4711e6c 100644 --- a/synapse/config/consent_config.py +++ b/synapse/config/consent_config.py @@ -34,6 +34,10 @@ DEFAULT_CONFIG = """\ # asking them to consent to the privacy policy. The 'server_notices' section # must also be configured for this to work. # +# 'block_events_error', if set, will block any attempts to send events +# until the user consents to the privacy policy. The value of the setting is +# used as the text of the error. +# # user_consent: # template_dir: res/templates/privacy # version: 1.0 @@ -41,6 +45,8 @@ DEFAULT_CONFIG = """\ # msgtype: m.text # body: | # Pls do consent kthx +# block_events_error: | +# You can't send any messages until you consent to the privacy policy. """ @@ -51,6 +57,7 @@ class ConsentConfig(Config): self.user_consent_version = None self.user_consent_template_dir = None self.user_consent_server_notice_content = None + self.block_events_without_consent_error = None def read_config(self, config): consent_config = config.get("user_consent") @@ -61,6 +68,9 @@ class ConsentConfig(Config): self.user_consent_server_notice_content = consent_config.get( "server_notice_content", ) + self.block_events_without_consent_error = consent_config.get( + "block_events_error", + ) def default_config(self, **kwargs): return DEFAULT_CONFIG |