0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-14 16:43:53 +01:00

Clarify when 3PID invite module callbacks are called (#17627)

Co-authored-by: Eric Eastwood <eric.eastwood@beta.gouv.fr>
This commit is contained in:
Andrew Morgan 2024-10-14 11:31:49 +01:00 committed by GitHub
parent f6a3e5e1c2
commit 451a9dc7b9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

1
changelog.d/17627.doc Normal file
View file

@ -0,0 +1 @@
Clarify when the `user_may_invite` and `user_may_send_3pid_invite` module callbacks are called.

View file

@ -76,8 +76,9 @@ _Changed in Synapse v1.62.0: `synapse.module_api.NOT_SPAM` and `synapse.module_a
async def user_may_invite(inviter: str, invitee: str, room_id: str) -> Union["synapse.module_api.NOT_SPAM", "synapse.module_api.errors.Codes", bool] async def user_may_invite(inviter: str, invitee: str, room_id: str) -> Union["synapse.module_api.NOT_SPAM", "synapse.module_api.errors.Codes", bool]
``` ```
Called when processing an invitation. Both inviter and invitee are Called when processing an invitation, both when one is created locally or when
represented by their Matrix user ID (e.g. `@alice:example.com`). receiving an invite over federation. Both inviter and invitee are represented by
their Matrix user ID (e.g. `@alice:example.com`).
The callback must return one of: The callback must return one of:
@ -112,7 +113,9 @@ async def user_may_send_3pid_invite(
``` ```
Called when processing an invitation using a third-party identifier (also called a 3PID, Called when processing an invitation using a third-party identifier (also called a 3PID,
e.g. an email address or a phone number). e.g. an email address or a phone number). It is only called when a 3PID invite is created
locally - not when one is received in a room over federation. If the 3PID is already associated
with a Matrix ID, the spam check will go through the `user_may_invite` callback instead.
The inviter is represented by their Matrix user ID (e.g. `@alice:example.com`), and the The inviter is represented by their Matrix user ID (e.g. `@alice:example.com`), and the
invitee is represented by its medium (e.g. "email") and its address invitee is represented by its medium (e.g. "email") and its address