diff --git a/roomserver/internal/alias.go b/roomserver/internal/alias.go index 0f0f4f0db..4139582b6 100644 --- a/roomserver/internal/alias.go +++ b/roomserver/internal/alias.go @@ -20,7 +20,6 @@ import ( "errors" "time" - appserviceAPI "github.com/matrix-org/dendrite/appservice/api" "github.com/matrix-org/dendrite/roomserver/api" "github.com/matrix-org/gomatrixserverlib" ) @@ -90,22 +89,28 @@ func (r *RoomserverInternalAPI) GetRoomIDForAlias( 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 - } + /* + TODO: Why is this here? It creates an unnecessary dependency + from the roomserver to the appservice component, which should be + altogether optional. - if aliasResp.AliasExists { - roomID, err = r.DB.GetRoomIDForAlias(ctx, request.Alias) - if err != nil { + 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 return nil diff --git a/roomserver/internal/api.go b/roomserver/internal/api.go index bc2785991..d1c443f24 100644 --- a/roomserver/internal/api.go +++ b/roomserver/internal/api.go @@ -6,7 +6,6 @@ import ( "sync" "github.com/Shopify/sarama" - appserviceAPI "github.com/matrix-org/dendrite/appservice/api" "github.com/matrix-org/dendrite/common" "github.com/matrix-org/dendrite/common/caching" "github.com/matrix-org/dendrite/common/config" @@ -29,7 +28,6 @@ type RoomserverInternalAPI struct { OutputRoomEventTopic string // Kafka topic for new output room events mutex sync.Mutex // Protects calls to processRoomEvent fsAPI fsAPI.FederationSenderInternalAPI - AppserviceAPI appserviceAPI.AppServiceQueryAPI } // SetupHTTP adds the RoomserverInternalAPI handlers to the http.ServeMux.