diff options
author | kegsay <kegan@matrix.org> | 2023-04-20 19:07:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-20 19:07:31 +0100 |
commit | 71eeccf34a2ea4434c315c19778d80a7b2469270 (patch) | |
tree | e6d5bd8f91a9a90b2b076f842c183bae332c6311 /internal | |
parent | 72285b2659a31ebd52c91799c17105d81d996f40 (diff) |
refactor: funnel event creation through room versions (#3060)
In preparation of interfacing up the room version value.
Diffstat (limited to 'internal')
-rw-r--r-- | internal/pushrules/evaluate_test.go | 2 | ||||
-rw-r--r-- | internal/transactionrequest.go | 2 | ||||
-rw-r--r-- | internal/transactionrequest_test.go | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/internal/pushrules/evaluate_test.go b/internal/pushrules/evaluate_test.go index ca8ae551..d2f6cecc 100644 --- a/internal/pushrules/evaluate_test.go +++ b/internal/pushrules/evaluate_test.go @@ -189,7 +189,7 @@ func TestPatternMatches(t *testing.T) { } func mustEventFromJSON(t *testing.T, json string) *gomatrixserverlib.Event { - ev, err := gomatrixserverlib.NewEventFromTrustedJSON([]byte(json), false, gomatrixserverlib.RoomVersionV7) + ev, err := gomatrixserverlib.RoomVersionV7.NewEventFromTrustedJSON([]byte(json), false) if err != nil { t.Fatal(err) } diff --git a/internal/transactionrequest.go b/internal/transactionrequest.go index 235a3123..a7c192e3 100644 --- a/internal/transactionrequest.go +++ b/internal/transactionrequest.go @@ -137,7 +137,7 @@ func (t *TxnReq) ProcessTransaction(ctx context.Context) (*fclient.RespSend, *ut continue } roomVersion := getRoomVersion(header.RoomID) - event, err := gomatrixserverlib.NewEventFromUntrustedJSON(pdu, roomVersion) + event, err := roomVersion.NewEventFromUntrustedJSON(pdu) if err != nil { if _, ok := err.(gomatrixserverlib.BadJSONError); ok { // Room version 6 states that homeservers should strictly enforce canonical JSON diff --git a/internal/transactionrequest_test.go b/internal/transactionrequest_test.go index b539e1a5..e178e0a4 100644 --- a/internal/transactionrequest_test.go +++ b/internal/transactionrequest_test.go @@ -633,7 +633,7 @@ func TestProcessTransactionRequestEDUUnhandled(t *testing.T) { func init() { for _, j := range testData { - e, err := gomatrixserverlib.NewEventFromTrustedJSON(j, false, testRoomVersion) + e, err := testRoomVersion.NewEventFromTrustedJSON(j, false) if err != nil { panic("cannot load test data: " + err.Error()) } |