mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-03 06:32:47 +00:00
A conditional is added to wrap the call to appserviceAPI if a local alias is not found in the database. Fixes #631 Signed-off-by: Serra Allgood <serra@allgood.dev>
This commit is contained in:
parent
7792f12e6f
commit
a0dec456c1
2 changed files with 211 additions and 6 deletions
|
@ -96,12 +96,21 @@ func (r *RoomserverAliasAPI) GetRoomIDForAlias(
|
|||
return err
|
||||
}
|
||||
|
||||
// No rooms found locally, try our application services by making a call to
|
||||
// the appservice component
|
||||
aliasReq := appserviceAPI.RoomAliasExistsRequest{Alias: request.Alias}
|
||||
var aliasResp appserviceAPI.RoomAliasExistsResponse
|
||||
if err = r.AppserviceAPI.RoomAliasExists(ctx, &aliasReq, &aliasResp); err != nil {
|
||||
return err
|
||||
if roomID == "" {
|
||||
// No room found locally, try our application services by making a call to
|
||||
// the appservice component
|
||||
aliasReq := appserviceAPI.RoomAliasExistsRequest{Alias: request.Alias}
|
||||
var aliasResp appserviceAPI.RoomAliasExistsResponse
|
||||
if err = r.AppserviceAPI.RoomAliasExists(ctx, &aliasReq, &aliasResp); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if aliasResp.AliasExists {
|
||||
roomID, err = r.DB.GetRoomIDForAlias(ctx, request.Alias)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
response.RoomID = roomID
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue