diff options
author | babolivier <babolivier@users.noreply.github.com> | 2022-05-23 17:28:14 +0000 |
---|---|---|
committer | babolivier <babolivier@users.noreply.github.com> | 2022-05-23 17:28:14 +0000 |
commit | 5e67bd766604818a50df6e434bb072a5b8a5ccfd (patch) | |
tree | 13776dbeae6202085a9202c26b8bc1e11ed7c293 /develop/upgrade.html | |
parent | deploy: a608ac847b36dd72634f21502be42e785add8b65 (diff) | |
download | synapse-5e67bd766604818a50df6e434bb072a5b8a5ccfd.tar.xz |
deploy: 28199e93579b5a73841a95ed4d355322227432b5
Diffstat (limited to '')
-rw-r--r-- | develop/upgrade.html | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/develop/upgrade.html b/develop/upgrade.html index d25faa39d0..81eb4ce480 100644 --- a/develop/upgrade.html +++ b/develop/upgrade.html @@ -295,6 +295,27 @@ COMMIT; <p><a href="https://github.com/matrix-org/synapse/issues/11779#issuecomment-1131545970">This comment on issue 11779</a> has queries that can be used to check a database for this problem in advance.</p> </details> +<h2 id="spamchecker-apis-check_event_for_spam-has-a-new-signature"><a class="header" href="#spamchecker-apis-check_event_for_spam-has-a-new-signature">SpamChecker API's <code>check_event_for_spam</code> has a new signature.</a></h2> +<p>The previous signature has been deprecated.</p> +<p>Whereas <code>check_event_for_spam</code> callbacks used to return <code>Union[str, bool]</code>, they should now return <code>Union["synapse.module_api.Allow", "synapse.module_api.errors.Codes"]</code>.</p> +<p>This is part of an ongoing refactoring of the SpamChecker API to make it less ambiguous and more powerful.</p> +<p>If your module implements <code>check_event_for_spam</code> as follows:</p> +<pre><code class="language-python">async def check_event_for_spam(event): + if ...: + # Event is spam + return True + # Event is not spam + return False +</code></pre> +<p>you should rewrite it as follows:</p> +<pre><code class="language-python">async def check_event_for_spam(event): + if ...: + # 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 +</code></pre> <h1 id="upgrading-to-v1590"><a class="header" href="#upgrading-to-v1590">Upgrading to v1.59.0</a></h1> <h2 id="device-name-lookup-over-federation-has-been-disabled-by-default"><a class="header" href="#device-name-lookup-over-federation-has-been-disabled-by-default">Device name lookup over federation has been disabled by default</a></h2> <p>The names of user devices are no longer visible to users on other homeservers by default. |