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

@ -150,7 +150,7 @@ func SendLeave(
}
// Decode the event JSON from the request.
event, err := gomatrixserverlib.NewEventFromUntrustedJSON(request.Content(), verRes.RoomVersion)
event, err := verRes.RoomVersion.NewEventFromUntrustedJSON(request.Content())
switch err.(type) {
case gomatrixserverlib.BadJSONError:
return util.JSONResponse{
@ -253,7 +253,7 @@ func SendLeave(
}
// 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 {
logrus.WithError(err).Errorf("XXX: leave.go")
return util.JSONResponse{