summary refs log tree commit diff
path: root/develop/upgrade.html
diff options
context:
space:
mode:
authorbabolivier <babolivier@users.noreply.github.com>2022-06-13 18:16:55 +0000
committerbabolivier <babolivier@users.noreply.github.com>2022-06-13 18:16:55 +0000
commite59ecd1890631f05edff18c3fd11a09d738eb72c (patch)
tree3221d9cb988582301cb196e3310e7a325610b3a4 /develop/upgrade.html
parentdeploy: 4579445cc54640341ef23cddad9c0518e90be63a (diff)
downloadsynapse-e59ecd1890631f05edff18c3fd11a09d738eb72c.tar.xz
deploy: a164a46038b0e51142781619db0e6dec8e0c2aaa
Diffstat (limited to '')
-rw-r--r--develop/upgrade.html31
1 files changed, 31 insertions, 0 deletions
diff --git a/develop/upgrade.html b/develop/upgrade.html
index 2ae6a34709..207d940e4e 100644
--- a/develop/upgrade.html
+++ b/develop/upgrade.html
@@ -232,6 +232,37 @@ dpkg -i matrix-synapse-py3_1.3.0+stretch1_amd64.deb
 </code></pre>
 </li>
 </ul>
+<h1 id="upgrading-to-v1610"><a class="header" href="#upgrading-to-v1610">Upgrading to v1.61.0</a></h1>
+<h2 id="new-signatures-for-spam-checker-callbacks"><a class="header" href="#new-signatures-for-spam-checker-callbacks">New signatures for spam checker callbacks</a></h2>
+<p>As a followup to changes in v1.60.0, the following spam-checker callbacks have changed signature:</p>
+<ul>
+<li><code>user_may_join_room</code></li>
+<li><code>user_may_invite</code></li>
+<li><code>user_may_send_3pid_invite</code></li>
+<li><code>user_may_create_room</code></li>
+<li><code>user_may_create_room_alias</code></li>
+<li><code>user_may_publish_room</code></li>
+<li><code>check_media_file_for_spam</code></li>
+</ul>
+<p>For each of these methods, the previous callback signature has been deprecated.</p>
+<p>Whereas callbacks used to return <code>bool</code>, they should now return <code>Union[&quot;synapse.module_api.NOT_SPAM&quot;, &quot;synapse.module_api.errors.Codes&quot;]</code>.</p>
+<p>For instance, if your module implements <code>user_may_join_room</code> as follows:</p>
+<pre><code class="language-python">async def user_may_join_room(self, user_id: str, room_id: str, is_invited: bool)
+    if ...:
+        # Request is spam
+        return False
+    # Request is not spam
+    return True
+</code></pre>
+<p>you should rewrite it as follows:</p>
+<pre><code class="language-python">async def user_may_join_room(self, user_id: str, room_id: str, is_invited: bool)
+    if ...:
+        # Request 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
+    # Request is not spam, mark it as such.
+    return synapse.module_api.NOT_SPAM
+</code></pre>
 <h1 id="upgrading-to-v1600"><a class="header" href="#upgrading-to-v1600">Upgrading to v1.60.0</a></h1>
 <h2 id="adding-a-new-unique-index-to-state_group_edges-could-fail-if-your-database-is-corrupted"><a class="header" href="#adding-a-new-unique-index-to-state_group_edges-could-fail-if-your-database-is-corrupted">Adding a new unique index to <code>state_group_edges</code> could fail if your database is corrupted</a></h2>
 <p>This release of Synapse will add a unique index to the <code>state_group_edges</code> table, in order