diff options
author | kegsay <kegan@matrix.org> | 2023-04-21 17:06:29 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-21 17:06:29 +0100 |
commit | 1647213facae52e2c8889fbc848ffc5d3a5792f0 (patch) | |
tree | 684206b99582df20ae144e19db37591cc35b789d /federationapi/routing/invite.go | |
parent | 71eeccf34a2ea4434c315c19778d80a7b2469270 (diff) |
Implement new RoomVersionImpl API (#3062)
As outlined in https://github.com/matrix-org/gomatrixserverlib/pull/368
The main change Dendrite side is that `RoomVersion` no longer has any
methods on it. Instead, you need to bounce via `gmsl.GetRoomVersion`.
It's very interesting to see where exactly Dendrite cares about this.
For some places it's creating events (fine) but others are way more
specific. Those areas will need to migrate to GMSL at some point.
Diffstat (limited to 'federationapi/routing/invite.go')
-rw-r--r-- | federationapi/routing/invite.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/federationapi/routing/invite.go b/federationapi/routing/invite.go index e9dbdb7d..b13e59f0 100644 --- a/federationapi/routing/invite.go +++ b/federationapi/routing/invite.go @@ -22,7 +22,6 @@ import ( "github.com/matrix-org/dendrite/clientapi/jsonerror" "github.com/matrix-org/dendrite/roomserver/api" - roomserverVersion "github.com/matrix-org/dendrite/roomserver/version" "github.com/matrix-org/dendrite/setup/config" "github.com/matrix-org/gomatrixserverlib" "github.com/matrix-org/gomatrixserverlib/fclient" @@ -78,7 +77,7 @@ func InviteV1( ) util.JSONResponse { roomVer := gomatrixserverlib.RoomVersionV1 body := request.Content() - event, err := roomVer.NewEventFromTrustedJSON(body, false) + event, err := gomatrixserverlib.MustGetRoomVersion(roomVer).NewEventFromTrustedJSON(body, false) switch err.(type) { case gomatrixserverlib.BadJSONError: return util.JSONResponse{ @@ -116,7 +115,8 @@ func processInvite( ) util.JSONResponse { // Check that we can accept invites for this room version. - if _, err := roomserverVersion.SupportedRoomVersion(roomVer); err != nil { + verImpl, err := gomatrixserverlib.GetRoomVersion(roomVer) + if err != nil { return util.JSONResponse{ Code: http.StatusBadRequest, JSON: jsonerror.UnsupportedRoomVersion( @@ -157,7 +157,7 @@ func processInvite( } // Check that the event is signed by the server sending the request. - redacted, err := event.Version().RedactEventJSON(event.JSON()) + redacted, err := verImpl.RedactEventJSON(event.JSON()) if err != nil { return util.JSONResponse{ Code: http.StatusBadRequest, |