Skip to content

Commit

Permalink
Add via parameter on join room requests as per MSC4156 (#3441)
Browse files Browse the repository at this point in the history
This implements
[MSC4156](matrix-org/matrix-spec-proposals#4156)
which will ship with Matrix 1.12 and is the continuation of
matrix-org/dendrite#3438.

### Pull Request Checklist

<!-- Please read
https://matrix-org.github.io/dendrite/development/contributing before
submitting your pull request -->

* [ ] 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 <n0-0ne+github@mailbox.org>

Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
Co-authored-by: Till <2353100+S7evinK@users.noreply.github.com>
  • Loading branch information
Johennes and S7evinK authored Dec 9, 2024
1 parent 7cc7ebb commit 7acf32f
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions clientapi/routing/joinroom.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 7acf32f

Please sign in to comment.