diff options
author | kegsay <kegan@matrix.org> | 2023-05-04 11:17:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-04 11:17:42 +0100 |
commit | 2b34f88fde6b3aa633c8f23ff424a5db4951efd3 (patch) | |
tree | bbf58904af8499f756fc1965f63a5ca359418c0a /setup | |
parent | d5c11a3c86bf1eeb7ae6b1c243ec889432fcd881 (diff) |
Use ProtoEvent where needed instead of EventBuilder (#3075)
They are fundamentally different concepts, so should be represented as
such. Proto events are exchanged in /make_xxx calls over federation, and
made as "fledgling" events in /createRoom and general event sending.
*Building* events is a reasonably complex VERSION SPECIFIC process which
needs amongst other things, auth event providers, prev events, signing
keys, etc.
Requires https://github.com/matrix-org/gomatrixserverlib/pull/379
Diffstat (limited to 'setup')
-rw-r--r-- | setup/mscs/msc2836/msc2836_test.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/setup/mscs/msc2836/msc2836_test.go b/setup/mscs/msc2836/msc2836_test.go index f235cfef..2c6f63d4 100644 --- a/setup/mscs/msc2836/msc2836_test.go +++ b/setup/mscs/msc2836/msc2836_test.go @@ -585,20 +585,20 @@ func mustCreateEvent(t *testing.T, ev fledglingEvent) (result *types.HeaderedEve roomVer := gomatrixserverlib.RoomVersionV6 seed := make([]byte, ed25519.SeedSize) // zero seed key := ed25519.NewKeyFromSeed(seed) - eb := gomatrixserverlib.EventBuilder{ + eb := gomatrixserverlib.MustGetRoomVersion(roomVer).NewEventBuilderFromProtoEvent(&gomatrixserverlib.ProtoEvent{ Sender: ev.Sender, Depth: 999, Type: ev.Type, StateKey: ev.StateKey, RoomID: ev.RoomID, - } + }) err := eb.SetContent(ev.Content) if err != nil { t.Fatalf("mustCreateEvent: failed to marshal event content %+v", ev.Content) } // make sure the origin_server_ts changes so we can test recency time.Sleep(1 * time.Millisecond) - signedEvent, err := eb.Build(time.Now(), spec.ServerName("localhost"), "ed25519:test", key, roomVer) + signedEvent, err := eb.Build(time.Now(), spec.ServerName("localhost"), "ed25519:test", key) if err != nil { t.Fatalf("mustCreateEvent: failed to sign event: %s", err) } |