Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maunium
synapse
Commits
ae8a616b
Unverified
Commit
ae8a616b
authored
3 years ago
by
Brendan Abolivier
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Correctly register deactivation and profile update module callbacks (#12141)
parent
6d282a9c
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
changelog.d/12141.bugfix
+1
-0
1 addition, 0 deletions
changelog.d/12141.bugfix
synapse/events/third_party_rules.py
+7
-3
7 additions, 3 deletions
synapse/events/third_party_rules.py
synapse/module_api/__init__.py
+8
-0
8 additions, 0 deletions
synapse/module_api/__init__.py
with
16 additions
and
3 deletions
changelog.d/12141.bugfix
0 → 100644
+
1
−
0
View file @
ae8a616b
Fix a bug introduced in Synapse 1.54.0rc1 preventing the new module callbacks introduced in this release from being registered by modules.
This diff is collapsed.
Click to expand it.
synapse/events/third_party_rules.py
+
7
−
3
View file @
ae8a616b
...
@@ -174,7 +174,9 @@ class ThirdPartyEventRules:
...
@@ -174,7 +174,9 @@ class ThirdPartyEventRules:
]
=
None
,
]
=
None
,
on_new_event
:
Optional
[
ON_NEW_EVENT_CALLBACK
]
=
None
,
on_new_event
:
Optional
[
ON_NEW_EVENT_CALLBACK
]
=
None
,
on_profile_update
:
Optional
[
ON_PROFILE_UPDATE_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
:
)
->
None
:
"""
Register callbacks from modules for each hook.
"""
"""
Register callbacks from modules for each hook.
"""
if
check_event_allowed
is
not
None
:
if
check_event_allowed
is
not
None
:
...
@@ -199,8 +201,10 @@ class ThirdPartyEventRules:
...
@@ -199,8 +201,10 @@ class ThirdPartyEventRules:
if
on_profile_update
is
not
None
:
if
on_profile_update
is
not
None
:
self
.
_on_profile_update_callbacks
.
append
(
on_profile_update
)
self
.
_on_profile_update_callbacks
.
append
(
on_profile_update
)
if
on_deactivation
is
not
None
:
if
on_user_deactivation_status_changed
is
not
None
:
self
.
_on_user_deactivation_status_changed_callbacks
.
append
(
on_deactivation
)
self
.
_on_user_deactivation_status_changed_callbacks
.
append
(
on_user_deactivation_status_changed
,
)
async
def
check_event_allowed
(
async
def
check_event_allowed
(
self
,
event
:
EventBase
,
context
:
EventContext
self
,
event
:
EventBase
,
context
:
EventContext
...
...
This diff is collapsed.
Click to expand it.
synapse/module_api/__init__.py
+
8
−
0
View file @
ae8a616b
...
@@ -59,6 +59,8 @@ from synapse.events.third_party_rules import (
...
@@ -59,6 +59,8 @@ from synapse.events.third_party_rules import (
CHECK_VISIBILITY_CAN_BE_MODIFIED_CALLBACK
,
CHECK_VISIBILITY_CAN_BE_MODIFIED_CALLBACK
,
ON_CREATE_ROOM_CALLBACK
,
ON_CREATE_ROOM_CALLBACK
,
ON_NEW_EVENT_CALLBACK
,
ON_NEW_EVENT_CALLBACK
,
ON_PROFILE_UPDATE_CALLBACK
,
ON_USER_DEACTIVATION_STATUS_CHANGED_CALLBACK
,
)
)
from
synapse.handlers.account_validity
import
(
from
synapse.handlers.account_validity
import
(
IS_USER_EXPIRED_CALLBACK
,
IS_USER_EXPIRED_CALLBACK
,
...
@@ -281,6 +283,10 @@ class ModuleApi:
...
@@ -281,6 +283,10 @@ class ModuleApi:
CHECK_VISIBILITY_CAN_BE_MODIFIED_CALLBACK
CHECK_VISIBILITY_CAN_BE_MODIFIED_CALLBACK
]
=
None
,
]
=
None
,
on_new_event
:
Optional
[
ON_NEW_EVENT_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
:
)
->
None
:
"""
Registers callbacks for third party event rules capabilities.
"""
Registers callbacks for third party event rules capabilities.
...
@@ -292,6 +298,8 @@ class ModuleApi:
...
@@ -292,6 +298,8 @@ class ModuleApi:
check_threepid_can_be_invited
=
check_threepid_can_be_invited
,
check_threepid_can_be_invited
=
check_threepid_can_be_invited
,
check_visibility_can_be_modified
=
check_visibility_can_be_modified
,
check_visibility_can_be_modified
=
check_visibility_can_be_modified
,
on_new_event
=
on_new_event
,
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
(
def
register_presence_router_callbacks
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment