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
Package registry
Container Registry
Model registry
Operate
Terraform modules
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
Timo Ley
synapse
Commits
e9f2ad86
Unverified
Commit
e9f2ad86
authored
3 years ago
by
Brendan Abolivier
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Describe callbacks signatures as async in new modules doc (#10206)
parent
1b3e398b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
changelog.d/10206.feature
+1
-0
1 addition, 0 deletions
changelog.d/10206.feature
docs/modules.md
+8
-8
8 additions, 8 deletions
docs/modules.md
with
9 additions
and
8 deletions
changelog.d/10206.feature
0 → 100644
+
1
−
0
View file @
e9f2ad86
Standardised
the
module
interface.
This diff is collapsed.
Click to expand it.
docs/modules.md
+
8
−
8
View file @
e9f2ad86
...
...
@@ -101,7 +101,7 @@ argument name and the function as its value. This is demonstrated in the example
The available spam checker callbacks are:
```
python
def
check_event_for_spam
(
event
:
"
synapse.events.EventBase
"
)
->
Union
[
bool
,
str
]
async
def
check_event_for_spam
(
event
:
"
synapse.events.EventBase
"
)
->
Union
[
bool
,
str
]
```
Called when receiving an event from a client or via federation. The module can return
...
...
@@ -110,7 +110,7 @@ to indicate the event must be rejected because of spam and to give a rejection r
forward to clients.
```
python
def
user_may_invite
(
inviter
:
str
,
invitee
:
str
,
room_id
:
str
)
->
bool
async
def
user_may_invite
(
inviter
:
str
,
invitee
:
str
,
room_id
:
str
)
->
bool
```
Called when processing an invitation. The module must return a
`bool`
indicating whether
...
...
@@ -118,14 +118,14 @@ the inviter can invite the invitee to the given room. Both inviter and invitee a
represented by their Matrix user ID (i.e.
`@alice:example.com`
).
```
python
def
user_may_create_room
(
user
:
str
)
->
bool
async
def
user_may_create_room
(
user
:
str
)
->
bool
```
Called when processing a room creation request. The module must return a
`bool`
indicating
whether the given user (represented by their Matrix user ID) is allowed to create a room.
```
python
def
user_may_create_room_alias
(
user
:
str
,
room_alias
:
"
synapse.types.RoomAlias
"
)
->
bool
async
def
user_may_create_room_alias
(
user
:
str
,
room_alias
:
"
synapse.types.RoomAlias
"
)
->
bool
```
Called when trying to associate an alias with an existing room. The module must return a
...
...
@@ -133,7 +133,7 @@ Called when trying to associate an alias with an existing room. The module must
to set the given alias.
```
python
def
user_may_publish_room
(
user
:
str
,
room_id
:
str
)
->
bool
async
def
user_may_publish_room
(
user
:
str
,
room_id
:
str
)
->
bool
```
Called when trying to publish a room to the homeserver's public rooms directory. The
...
...
@@ -141,7 +141,7 @@ module must return a `bool` indicating whether the given user (represented by th
Matrix user ID) is allowed to publish the given room.
```
python
def
check_username_for_spam
(
user_profile
:
Dict
[
str
,
str
])
->
bool
async
def
check_username_for_spam
(
user_profile
:
Dict
[
str
,
str
])
->
bool
```
Called when computing search results in the user directory. The module must return a
...
...
@@ -156,7 +156,7 @@ The module is given a copy of the original dictionary, so modifying it from with
module cannot modify a user's profile when included in user directory search results.
```
python
def
check_registration_for_spam
(
async
def
check_registration_for_spam
(
email_threepid
:
Optional
[
dict
],
username
:
Optional
[
str
],
request_info
:
Collection
[
Tuple
[
str
,
str
]],
...
...
@@ -179,7 +179,7 @@ The arguments passed to this callback are:
*
`auth_provider_id`
: The identifier of the SSO authentication provider, if any.
```
python
def
check_media_file_for_spam
(
async
def
check_media_file_for_spam
(
file_wrapper
:
"
synapse.rest.media.v1.media_storage.ReadableFileWrapper
"
,
file_info
:
"
synapse.rest.media.v1._base.FileInfo
"
)
->
bool
...
...
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