From 265c1fca25740f1299bf9feba78ac16861c3056f Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 3 Jan 2024 14:09:19 +0000 Subject: [PATCH 1/2] Add recursion_depth to /relations if recursing This is an extra response parameter just added to MSC3981. In the current impl, the recursion depth is always 3, so this just returns a static 3 if the recurse parameter is supplied. --- synapse/handlers/relations.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/synapse/handlers/relations.py b/synapse/handlers/relations.py index 444b795872f..642f7acf97b 100644 --- a/synapse/handlers/relations.py +++ b/synapse/handlers/relations.py @@ -180,6 +180,10 @@ async def get_relations( config=serialize_options, ), } + + if recurse: + return_value["recursion_depth"] = 3 + if include_original_event: # Do not bundle aggregations when retrieving the original event because # we want the content before relations are applied to it. From a628e462fdc1e1477be09300e492fe18c1d5243a Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 3 Jan 2024 14:12:41 +0000 Subject: [PATCH 2/2] Add newsfile --- changelog.d/16775.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/16775.bugfix diff --git a/changelog.d/16775.bugfix b/changelog.d/16775.bugfix new file mode 100644 index 00000000000..99f04ca59d6 --- /dev/null +++ b/changelog.d/16775.bugfix @@ -0,0 +1 @@ +Adds the recursion_depth parameter to the response of the /relations endpoint if MSC3981 recursion is being performed.