Improve the room version check

This commit is contained in:
Neil Alexander 2020-04-23 10:14:58 +01:00
parent d44816090a
commit 67b47d98bd

View file

@ -22,7 +22,7 @@ import (
"github.com/matrix-org/dendrite/clientapi/jsonerror" "github.com/matrix-org/dendrite/clientapi/jsonerror"
"github.com/matrix-org/dendrite/clientapi/producers" "github.com/matrix-org/dendrite/clientapi/producers"
"github.com/matrix-org/dendrite/common/config" "github.com/matrix-org/dendrite/common/config"
"github.com/matrix-org/dendrite/roomserver/version" roomserverVersion "github.com/matrix-org/dendrite/roomserver/version"
"github.com/matrix-org/gomatrixserverlib" "github.com/matrix-org/gomatrixserverlib"
"github.com/matrix-org/util" "github.com/matrix-org/util"
) )
@ -47,7 +47,8 @@ func Invite(
event := inviteReq.Event() event := inviteReq.Event()
// Check if we support the room version for the invite. // Check if we support the room version for the invite.
if roomVersion, err := version.SupportedRoomVersion(inviteReq.RoomVersion()); err != nil { roomVersion := inviteReq.RoomVersion()
if _, err := roomserverVersion.SupportedRoomVersion(roomVersion); err != nil {
return util.JSONResponse{ return util.JSONResponse{
Code: http.StatusBadRequest, Code: http.StatusBadRequest,
JSON: jsonerror.UnsupportedRoomVersion( JSON: jsonerror.UnsupportedRoomVersion(