From 7acf32f24d95ec24ae1d921c64b64331756fccef Mon Sep 17 00:00:00 2001 From: Johannes Marbach Date: Mon, 9 Dec 2024 20:31:20 +0100 Subject: [PATCH] Add via parameter on join room requests as per MSC4156 (#3441) This implements [MSC4156](https://github.com/matrix-org/matrix-spec-proposals/pull/4156) which will ship with Matrix 1.12 and is the continuation of https://github.com/matrix-org/dendrite/pull/3438. ### Pull Request Checklist * [ ] I have added Go unit tests or [Complement integration tests](https://github.com/matrix-org/complement) for this PR _or_ I have justified why this PR doesn't need tests * [x] Pull request includes a [sign off below using a legally identifiable name](https://matrix-org.github.io/dendrite/development/contributing#sign-off) _or_ I have already signed off privately Signed-off-by: Johannes Marbach Signed-off-by: Johannes Marbach Co-authored-by: Till <2353100+S7evinK@users.noreply.github.com> --- clientapi/routing/joinroom.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/clientapi/routing/joinroom.go b/clientapi/routing/joinroom.go index 30cb3233..275d356a 100644 --- a/clientapi/routing/joinroom.go +++ b/clientapi/routing/joinroom.go @@ -36,9 +36,16 @@ func JoinRoomByIDOrAlias( Content: map[string]interface{}{}, } - // Check to see if any ?server_name= query parameters were - // given in the request. - if serverNames, ok := req.URL.Query()["server_name"]; ok { + // Check to see if any ?via= or ?server_name= query parameters + // were given in the request. + if serverNames, ok := req.URL.Query()["via"]; ok { + for _, serverName := range serverNames { + joinReq.ServerNames = append( + joinReq.ServerNames, + spec.ServerName(serverName), + ) + } + } else if serverNames, ok := req.URL.Query()["server_name"]; ok { for _, serverName := range serverNames { joinReq.ServerNames = append( joinReq.ServerNames,