diff options
author | Brendan Abolivier <babolivier@matrix.org> | 2022-03-03 11:39:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-03 11:39:58 +0100 |
commit | ae8a616b4926a005cd73db835a1ebcea4f5cbee0 (patch) | |
tree | 3e31c0732c0a0a2ed353036c9cb8dc327f6aa48f /synapse | |
parent | Make release script write correct no-op changelog (#12127) (diff) | |
download | synapse-ae8a616b4926a005cd73db835a1ebcea4f5cbee0.tar.xz |
Correctly register deactivation and profile update module callbacks (#12141)
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/events/third_party_rules.py | 10 | ||||
-rw-r--r-- | synapse/module_api/__init__.py | 8 |
2 files changed, 15 insertions, 3 deletions
diff --git a/synapse/events/third_party_rules.py b/synapse/events/third_party_rules.py index dd3104faf3..ede72ee876 100644 --- a/synapse/events/third_party_rules.py +++ b/synapse/events/third_party_rules.py @@ -174,7 +174,9 @@ class ThirdPartyEventRules: ] = None, on_new_event: Optional[ON_NEW_EVENT_CALLBACK] = None, on_profile_update: Optional[ON_PROFILE_UPDATE_CALLBACK] = None, - on_deactivation: Optional[ON_USER_DEACTIVATION_STATUS_CHANGED_CALLBACK] = None, + on_user_deactivation_status_changed: Optional[ + ON_USER_DEACTIVATION_STATUS_CHANGED_CALLBACK + ] = None, ) -> None: """Register callbacks from modules for each hook.""" if check_event_allowed is not None: @@ -199,8 +201,10 @@ class ThirdPartyEventRules: if on_profile_update is not None: self._on_profile_update_callbacks.append(on_profile_update) - if on_deactivation is not None: - self._on_user_deactivation_status_changed_callbacks.append(on_deactivation) + if on_user_deactivation_status_changed is not None: + self._on_user_deactivation_status_changed_callbacks.append( + on_user_deactivation_status_changed, + ) async def check_event_allowed( self, event: EventBase, context: EventContext diff --git a/synapse/module_api/__init__.py b/synapse/module_api/__init__.py index 7e46931869..c42eeedd87 100644 --- a/synapse/module_api/__init__.py +++ b/synapse/module_api/__init__.py @@ -59,6 +59,8 @@ from synapse.events.third_party_rules import ( CHECK_VISIBILITY_CAN_BE_MODIFIED_CALLBACK, ON_CREATE_ROOM_CALLBACK, ON_NEW_EVENT_CALLBACK, + ON_PROFILE_UPDATE_CALLBACK, + ON_USER_DEACTIVATION_STATUS_CHANGED_CALLBACK, ) from synapse.handlers.account_validity import ( IS_USER_EXPIRED_CALLBACK, @@ -281,6 +283,10 @@ class ModuleApi: CHECK_VISIBILITY_CAN_BE_MODIFIED_CALLBACK ] = None, on_new_event: Optional[ON_NEW_EVENT_CALLBACK] = None, + on_profile_update: Optional[ON_PROFILE_UPDATE_CALLBACK] = None, + on_user_deactivation_status_changed: Optional[ + ON_USER_DEACTIVATION_STATUS_CHANGED_CALLBACK + ] = None, ) -> None: """Registers callbacks for third party event rules capabilities. @@ -292,6 +298,8 @@ class ModuleApi: check_threepid_can_be_invited=check_threepid_can_be_invited, check_visibility_can_be_modified=check_visibility_can_be_modified, on_new_event=on_new_event, + on_profile_update=on_profile_update, + on_user_deactivation_status_changed=on_user_deactivation_status_changed, ) def register_presence_router_callbacks( |