diff options
author | kegsay <kegan@matrix.org> | 2023-05-02 15:03:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-02 15:03:16 +0100 |
commit | f5b3144dc33ddcb2ab161323d422cab257d04b4c (patch) | |
tree | 07d3b03944d2529d96c29674a96c3e76a76ae3b9 /syncapi/types | |
parent | 696cbb70b8cc8d663f7bb7c7a5f25cd57ea6803e (diff) |
Use PDU not *Event in HeaderedEvent (#3073)
Requires https://github.com/matrix-org/gomatrixserverlib/pull/376
This has numerous upsides:
- Less type casting to `*Event` is required.
- Making Dendrite work with `PDU` interfaces means we can swap out Event
impls more easily.
- Tests which represent weird event shapes are easier to write.
Part of a series of refactors on GMSL.
Diffstat (limited to 'syncapi/types')
-rw-r--r-- | syncapi/types/types.go | 2 | ||||
-rw-r--r-- | syncapi/types/types_test.go | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/syncapi/types/types.go b/syncapi/types/types.go index 983bf48a..22c27fea 100644 --- a/syncapi/types/types.go +++ b/syncapi/types/types.go @@ -552,7 +552,7 @@ func NewInviteResponse(event *types.HeaderedEvent) *InviteResponse { // Then we'll see if we can create a partial of the invite event itself. // This is needed for clients to work out *who* sent the invite. - inviteEvent := synctypes.ToClientEvent(event.Event, synctypes.FormatSync) + inviteEvent := synctypes.ToClientEvent(event.PDU, synctypes.FormatSync) inviteEvent.Unsigned = nil if ev, err := json.Marshal(inviteEvent); err == nil { res.InviteState.Events = append(res.InviteState.Events, ev) diff --git a/syncapi/types/types_test.go b/syncapi/types/types_test.go index 60ff02bd..8e0448fe 100644 --- a/syncapi/types/types_test.go +++ b/syncapi/types/types_test.go @@ -56,7 +56,7 @@ func TestNewInviteResponse(t *testing.T) { t.Fatal(err) } - res := NewInviteResponse(&types.HeaderedEvent{Event: ev}) + res := NewInviteResponse(&types.HeaderedEvent{PDU: ev}) j, err := json.Marshal(res) if err != nil { t.Fatal(err) |