diff options
author | Will Hunt <will@half-shot.uk> | 2021-03-03 17:00:31 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-03 17:00:31 +0000 |
commit | 9557ccada4efe50d0f370019ad0b9f017fc7ebcf (patch) | |
tree | 8f0d52d793180ce05b9235bdd1da10ee3a7d76ef /clientapi | |
parent | a2773922d2fe40e6d95d73f532640702709ab526 (diff) |
Fix appsevice alias queries part 2 (#1684)
* Check membership of room
* Use QueryStateAfterEventsResponse
* Fix complexity
* Add field ShouldHitAppservice to GetRoomIDForAlias
* Hit appservice when trying to join a non-existent alias
* remove unused
* Changes that I made a long time ago
* Rename to appserviceJoinedAtEvent
* Check membership in GetMemberships
* Update QueryMembershipsForRoom
* Tweaks in client API
* Update appserviceJoinedAtEvent
* Comments
* Try QueryMembershipForUser instead
* Undo some changes to client API that shouldn't be needed
* More /event tweaks
* Refactor /event bit
* Go back to QueryMembershipsForRoom because appservices are hard
* Fix bugs in onMessage
* Add comments
* More logical naming, clean up a bit
Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
Diffstat (limited to 'clientapi')
-rw-r--r-- | clientapi/routing/createroom.go | 3 | ||||
-rw-r--r-- | clientapi/routing/directory.go | 9 |
2 files changed, 8 insertions, 4 deletions
diff --git a/clientapi/routing/createroom.go b/clientapi/routing/createroom.go index 9be0b512..2d886746 100644 --- a/clientapi/routing/createroom.go +++ b/clientapi/routing/createroom.go @@ -217,7 +217,8 @@ func createRoom( roomAlias = fmt.Sprintf("#%s:%s", r.RoomAliasName, cfg.Matrix.ServerName) // check it's free TODO: This races but is better than nothing hasAliasReq := roomserverAPI.GetRoomIDForAliasRequest{ - Alias: roomAlias, + Alias: roomAlias, + IncludeAppservices: false, } var aliasResp roomserverAPI.GetRoomIDForAliasResponse diff --git a/clientapi/routing/directory.go b/clientapi/routing/directory.go index 1b844c4e..0e994b64 100644 --- a/clientapi/routing/directory.go +++ b/clientapi/routing/directory.go @@ -61,9 +61,12 @@ func DirectoryRoom( var res roomDirectoryResponse // Query the roomserver API to check if the alias exists locally. - queryReq := roomserverAPI.GetRoomIDForAliasRequest{Alias: roomAlias} - var queryRes roomserverAPI.GetRoomIDForAliasResponse - if err = rsAPI.GetRoomIDForAlias(req.Context(), &queryReq, &queryRes); err != nil { + queryReq := &roomserverAPI.GetRoomIDForAliasRequest{ + Alias: roomAlias, + IncludeAppservices: true, + } + queryRes := &roomserverAPI.GetRoomIDForAliasResponse{} + if err = rsAPI.GetRoomIDForAlias(req.Context(), queryReq, queryRes); err != nil { util.GetLogger(req.Context()).WithError(err).Error("rsAPI.GetRoomIDForAlias failed") return jsonerror.InternalServerError() } |