summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2022-09-27 10:47:34 -0400
committerGitHub <noreply@github.com>2022-09-27 10:47:34 -0400
commit87fe9db4675e510ea9c0234429b4773341c4e86d (patch)
tree43462024ac1fe7dc1178f6669710d5112f8e6d9b /synapse
parentPrioritize outbound to-device over device list updates (#13922) (diff)
downloadsynapse-87fe9db4675e510ea9c0234429b4773341c4e86d.tar.xz
Support the stable dir parameter for /relations. (#13920)
Since MSC3715 has passed FCP, the stable parameter can be used.

This currently falls back to the unstable parameter if the stable
parameter is not provided (and MSC3715 support is enabled in
the configuration).
Diffstat (limited to 'synapse')
-rw-r--r--synapse/rest/client/relations.py24
1 files changed, 15 insertions, 9 deletions
diff --git a/synapse/rest/client/relations.py b/synapse/rest/client/relations.py
index ce97080013..205c556f64 100644
--- a/synapse/rest/client/relations.py
+++ b/synapse/rest/client/relations.py
@@ -56,15 +56,21 @@ class RelationPaginationServlet(RestServlet):
         requester = await self.auth.get_user_by_req(request, allow_guest=True)
 
         limit = parse_integer(request, "limit", default=5)
-        if self._msc3715_enabled:
-            direction = parse_string(
-                request,
-                "org.matrix.msc3715.dir",
-                default="b",
-                allowed_values=["f", "b"],
-            )
-        else:
-            direction = "b"
+        # Fetch the direction parameter, if provided.
+        #
+        # TODO Use PaginationConfig.from_request when the unstable parameter is
+        #      no longer needed.
+        direction = parse_string(request, "dir", allowed_values=["f", "b"])
+        if direction is None:
+            if self._msc3715_enabled:
+                direction = parse_string(
+                    request,
+                    "org.matrix.msc3715.dir",
+                    default="b",
+                    allowed_values=["f", "b"],
+                )
+            else:
+                direction = "b"
         from_token_str = parse_string(request, "from")
         to_token_str = parse_string(request, "to")