summary refs log tree commit diff
path: root/synapse/handlers/message.py
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2019-03-19 12:19:20 +0000
committerRichard van der Hoff <richard@matrix.org>2019-03-19 12:19:20 +0000
commit2561b628af267ab567118a3e40038504c60acf41 (patch)
treee283996a2db1e6fa540c1ae963ca7c03903d06cc /synapse/handlers/message.py
parentRevert "Reinstate EDU-batching hacks" (diff)
parentfix test_auto_create_auto_join_where_no_consent (#4886) (diff)
downloadsynapse-2561b628af267ab567118a3e40038504c60acf41.tar.xz
Merge branch 'develop' into matrix-org-hotfixes
Diffstat (limited to 'synapse/handlers/message.py')
-rw-r--r--synapse/handlers/message.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py

index 63793b1fcf..578320607e 100644 --- a/synapse/handlers/message.py +++ b/synapse/handlers/message.py
@@ -243,7 +243,14 @@ class EventCreationHandler(object): self.spam_checker = hs.get_spam_checker() - if self.config.block_events_without_consent_error is not None: + self._block_events_without_consent_error = ( + self.config.block_events_without_consent_error + ) + + # we need to construct a ConsentURIBuilder here, as it checks that the necessary + # config options, but *only* if we have a configuration for which we are + # going to need it. + if self._block_events_without_consent_error: self._consent_uri_builder = ConsentURIBuilder(self.config) @defer.inlineCallbacks @@ -378,7 +385,7 @@ class EventCreationHandler(object): Raises: ConsentNotGivenError: if the user has not given consent yet """ - if self.config.block_events_without_consent_error is None: + if self._block_events_without_consent_error is None: return # exempt AS users from needing consent @@ -405,7 +412,7 @@ class EventCreationHandler(object): consent_uri = self._consent_uri_builder.build_user_consent_uri( requester.user.localpart, ) - msg = self.config.block_events_without_consent_error % { + msg = self._block_events_without_consent_error % { 'consent_uri': consent_uri, } raise ConsentNotGivenError(