diff options
author | Brendan Abolivier <babolivier@matrix.org> | 2021-07-20 12:39:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-20 12:39:46 +0200 |
commit | a743bf46949e851c9a10d8e01a138659f3af2484 (patch) | |
tree | fc6fe51e777b197c83d3aef49011fe13d35b7130 /synapse/handlers/message.py | |
parent | Fix exception when failing to get remote room list (#10414) (diff) | |
download | synapse-a743bf46949e851c9a10d8e01a138659f3af2484.tar.xz |
Port the ThirdPartyEventRules module interface to the new generic interface (#10386)
Port the third-party event rules interface to the generic module interface introduced in v1.37.0
Diffstat (limited to 'synapse/handlers/message.py')
-rw-r--r-- | synapse/handlers/message.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py index c7fe4ff89e..8a0024ce84 100644 --- a/synapse/handlers/message.py +++ b/synapse/handlers/message.py @@ -949,10 +949,10 @@ class EventCreationHandler: if requester: context.app_service = requester.app_service - third_party_result = await self.third_party_event_rules.check_event_allowed( + res, new_content = await self.third_party_event_rules.check_event_allowed( event, context ) - if not third_party_result: + if res is False: logger.info( "Event %s forbidden by third-party rules", event, @@ -960,11 +960,11 @@ class EventCreationHandler: raise SynapseError( 403, "This event is not allowed in this context", Codes.FORBIDDEN ) - elif isinstance(third_party_result, dict): + elif new_content is not None: # the third-party rules want to replace the event. We'll need to build a new # event. event, context = await self._rebuild_event_after_third_party_rules( - third_party_result, event + new_content, event ) self.validator.validate_new(event, self.config) |