diff options
author | Brendan Abolivier <babolivier@matrix.org> | 2022-05-31 12:04:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-31 12:04:53 +0200 |
commit | 8fd87739bf9653a77fff9669d4f307e8b1bcd1eb (patch) | |
tree | f0b209980fdb2c0818320b7e91ba0a7a95530e5c /docs/upgrade.md | |
parent | 1.60.0rc2 (diff) | |
download | synapse-8fd87739bf9653a77fff9669d4f307e8b1bcd1eb.tar.xz |
Fix import in module_api module and docs on the new check_event_for_spam signature (#12918)
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
Diffstat (limited to 'docs/upgrade.md')
-rw-r--r-- | docs/upgrade.md | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/upgrade.md b/docs/upgrade.md index e7eadadb64..e3c64da17f 100644 --- a/docs/upgrade.md +++ b/docs/upgrade.md @@ -177,11 +177,11 @@ has queries that can be used to check a database for this problem in advance. </details> -## SpamChecker API's `check_event_for_spam` has a new signature. +## New signature for the spam checker callback `check_event_for_spam` The previous signature has been deprecated. -Whereas `check_event_for_spam` callbacks used to return `Union[str, bool]`, they should now return `Union["synapse.module_api.Allow", "synapse.module_api.errors.Codes"]`. +Whereas `check_event_for_spam` callbacks used to return `Union[str, bool]`, they should now return `Union["synapse.module_api.NOT_SPAM", "synapse.module_api.errors.Codes"]`. This is part of an ongoing refactoring of the SpamChecker API to make it less ambiguous and more powerful. @@ -204,8 +204,8 @@ async def check_event_for_spam(event): # Event is spam, mark it as forbidden (you may use some more precise error # code if it is useful). return synapse.module_api.errors.Codes.FORBIDDEN - # Event is not spam, mark it as `ALLOW`. - return synapse.module_api.ALLOW + # Event is not spam, mark it as such. + return synapse.module_api.NOT_SPAM ``` # Upgrading to v1.59.0 |