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

Commit ae8a616

Browse files
authored
Correctly register deactivation and profile update module callbacks (#12141)
1 parent 6d282a9 commit ae8a616

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

changelog.d/12141.bugfix

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a bug introduced in Synapse 1.54.0rc1 preventing the new module callbacks introduced in this release from being registered by modules.

synapse/events/third_party_rules.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,9 @@ def register_third_party_rules_callbacks(
174174
] = None,
175175
on_new_event: Optional[ON_NEW_EVENT_CALLBACK] = None,
176176
on_profile_update: Optional[ON_PROFILE_UPDATE_CALLBACK] = None,
177-
on_deactivation: Optional[ON_USER_DEACTIVATION_STATUS_CHANGED_CALLBACK] = None,
177+
on_user_deactivation_status_changed: Optional[
178+
ON_USER_DEACTIVATION_STATUS_CHANGED_CALLBACK
179+
] = None,
178180
) -> None:
179181
"""Register callbacks from modules for each hook."""
180182
if check_event_allowed is not None:
@@ -199,8 +201,10 @@ def register_third_party_rules_callbacks(
199201
if on_profile_update is not None:
200202
self._on_profile_update_callbacks.append(on_profile_update)
201203

202-
if on_deactivation is not None:
203-
self._on_user_deactivation_status_changed_callbacks.append(on_deactivation)
204+
if on_user_deactivation_status_changed is not None:
205+
self._on_user_deactivation_status_changed_callbacks.append(
206+
on_user_deactivation_status_changed,
207+
)
204208

205209
async def check_event_allowed(
206210
self, event: EventBase, context: EventContext

synapse/module_api/__init__.py

+8
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@
5959
CHECK_VISIBILITY_CAN_BE_MODIFIED_CALLBACK,
6060
ON_CREATE_ROOM_CALLBACK,
6161
ON_NEW_EVENT_CALLBACK,
62+
ON_PROFILE_UPDATE_CALLBACK,
63+
ON_USER_DEACTIVATION_STATUS_CHANGED_CALLBACK,
6264
)
6365
from synapse.handlers.account_validity import (
6466
IS_USER_EXPIRED_CALLBACK,
@@ -281,6 +283,10 @@ def register_third_party_rules_callbacks(
281283
CHECK_VISIBILITY_CAN_BE_MODIFIED_CALLBACK
282284
] = None,
283285
on_new_event: Optional[ON_NEW_EVENT_CALLBACK] = None,
286+
on_profile_update: Optional[ON_PROFILE_UPDATE_CALLBACK] = None,
287+
on_user_deactivation_status_changed: Optional[
288+
ON_USER_DEACTIVATION_STATUS_CHANGED_CALLBACK
289+
] = None,
284290
) -> None:
285291
"""Registers callbacks for third party event rules capabilities.
286292
@@ -292,6 +298,8 @@ def register_third_party_rules_callbacks(
292298
check_threepid_can_be_invited=check_threepid_can_be_invited,
293299
check_visibility_can_be_modified=check_visibility_can_be_modified,
294300
on_new_event=on_new_event,
301+
on_profile_update=on_profile_update,
302+
on_user_deactivation_status_changed=on_user_deactivation_status_changed,
295303
)
296304

297305
def register_presence_router_callbacks(

0 commit comments

Comments
 (0)