refactor: funnel event creation through room versions (#3060)

In preparation of interfacing up the room version value.
This commit is contained in:
kegsay 2023-04-20 19:07:31 +01:00 committed by GitHub
parent 72285b2659
commit 71eeccf34a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 41 additions and 35 deletions

View file

@ -78,7 +78,7 @@ func InviteV1(
) util.JSONResponse {
roomVer := gomatrixserverlib.RoomVersionV1
body := request.Content()
event, err := gomatrixserverlib.NewEventFromTrustedJSON(body, false, roomVer)
event, err := roomVer.NewEventFromTrustedJSON(body, false)
switch err.(type) {
case gomatrixserverlib.BadJSONError:
return util.JSONResponse{
@ -157,7 +157,7 @@ func processInvite(
}
// Check that the event is signed by the server sending the request.
redacted, err := gomatrixserverlib.RedactEventJSON(event.JSON(), event.Version())
redacted, err := event.Version().RedactEventJSON(event.JSON())
if err != nil {
return util.JSONResponse{
Code: http.StatusBadRequest,