mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-30 21:12:45 +00:00
refactor: funnel event creation through room versions (#3060)
In preparation of interfacing up the room version value.
This commit is contained in:
parent
72285b2659
commit
71eeccf34a
21 changed files with 41 additions and 35 deletions
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue