mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Move the (unstable) dir
parameter for /relations behind an experimental flag. (#12984)
MSC3715 defines this parameter, but the unstable version of it should be behind an experimental flag.
This commit is contained in:
parent
3c8f1290b8
commit
dd2d66b0c9
1
changelog.d/12984.misc
Normal file
1
changelog.d/12984.misc
Normal file
@ -0,0 +1 @@
|
|||||||
|
Move [MSC3715](https://github.com/matrix-org/matrix-spec-proposals/pull/3715) behind an experimental config flag.
|
@ -84,3 +84,6 @@ class ExperimentalConfig(Config):
|
|||||||
|
|
||||||
# MSC3772: A push rule for mutual relations.
|
# MSC3772: A push rule for mutual relations.
|
||||||
self.msc3772_enabled: bool = experimental.get("msc3772_enabled", False)
|
self.msc3772_enabled: bool = experimental.get("msc3772_enabled", False)
|
||||||
|
|
||||||
|
# MSC3715: dir param on /relations.
|
||||||
|
self.msc3715_enabled: bool = experimental.get("msc3715_enabled", False)
|
||||||
|
@ -43,6 +43,7 @@ class RelationPaginationServlet(RestServlet):
|
|||||||
self.auth = hs.get_auth()
|
self.auth = hs.get_auth()
|
||||||
self.store = hs.get_datastores().main
|
self.store = hs.get_datastores().main
|
||||||
self._relations_handler = hs.get_relations_handler()
|
self._relations_handler = hs.get_relations_handler()
|
||||||
|
self._msc3715_enabled = hs.config.experimental.msc3715_enabled
|
||||||
|
|
||||||
async def on_GET(
|
async def on_GET(
|
||||||
self,
|
self,
|
||||||
@ -55,9 +56,15 @@ class RelationPaginationServlet(RestServlet):
|
|||||||
requester = await self.auth.get_user_by_req(request, allow_guest=True)
|
requester = await self.auth.get_user_by_req(request, allow_guest=True)
|
||||||
|
|
||||||
limit = parse_integer(request, "limit", default=5)
|
limit = parse_integer(request, "limit", default=5)
|
||||||
|
if self._msc3715_enabled:
|
||||||
direction = parse_string(
|
direction = parse_string(
|
||||||
request, "org.matrix.msc3715.dir", default="b", allowed_values=["f", "b"]
|
request,
|
||||||
|
"org.matrix.msc3715.dir",
|
||||||
|
default="b",
|
||||||
|
allowed_values=["f", "b"],
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
direction = "b"
|
||||||
from_token_str = parse_string(request, "from")
|
from_token_str = parse_string(request, "from")
|
||||||
to_token_str = parse_string(request, "to")
|
to_token_str = parse_string(request, "to")
|
||||||
|
|
||||||
|
@ -728,6 +728,7 @@ class RelationsTestCase(BaseRelationsTestCase):
|
|||||||
|
|
||||||
|
|
||||||
class RelationPaginationTestCase(BaseRelationsTestCase):
|
class RelationPaginationTestCase(BaseRelationsTestCase):
|
||||||
|
@unittest.override_config({"experimental_features": {"msc3715_enabled": True}})
|
||||||
def test_basic_paginate_relations(self) -> None:
|
def test_basic_paginate_relations(self) -> None:
|
||||||
"""Tests that calling pagination API correctly the latest relations."""
|
"""Tests that calling pagination API correctly the latest relations."""
|
||||||
channel = self._send_relation(RelationTypes.ANNOTATION, "m.reaction", "a")
|
channel = self._send_relation(RelationTypes.ANNOTATION, "m.reaction", "a")
|
||||||
|
Loading…
Reference in New Issue
Block a user