diff --git a/src/github.com/matrix-org/dendrite/syncapi/consumers/roomserver.go b/src/github.com/matrix-org/dendrite/syncapi/consumers/roomserver.go index 911ccd0d9..ca46828f9 100644 --- a/src/github.com/matrix-org/dendrite/syncapi/consumers/roomserver.go +++ b/src/github.com/matrix-org/dendrite/syncapi/consumers/roomserver.go @@ -38,12 +38,6 @@ type OutputRoomEvent struct { query api.RoomserverQueryAPI } -type prevEventRef struct { - PrevContent json.RawMessage `json:"prev_content"` - PrevID string `json:"replaces_state"` - UserID string `json:"prev_sender"` -} - // NewOutputRoomEvent creates a new OutputRoomEvent consumer. Call Start() to begin consuming from room servers. func NewOutputRoomEvent( cfg *config.Dendrite, @@ -267,10 +261,10 @@ func (s *OutputRoomEvent) updateStateEvent(event gomatrixserverlib.Event) (gomat return event, nil } - prev := prevEventRef{ + prev := types.PrevEventRef{ PrevContent: prevEvent.Content(), PrevID: prevEvent.EventID(), - UserID: prevEvent.Sender(), + PrevSender: prevEvent.Sender(), } return event.SetUnsigned(prev) diff --git a/src/github.com/matrix-org/dendrite/syncapi/types/types.go b/src/github.com/matrix-org/dendrite/syncapi/types/types.go index adc764c32..cf737a408 100644 --- a/src/github.com/matrix-org/dendrite/syncapi/types/types.go +++ b/src/github.com/matrix-org/dendrite/syncapi/types/types.go @@ -15,6 +15,7 @@ package types import ( + "encoding/json" "strconv" "github.com/matrix-org/gomatrixserverlib" @@ -28,6 +29,13 @@ func (sp StreamPosition) String() string { return strconv.FormatInt(int64(sp), 10) } +// PrevEventRef represents a reference to a previous event in a state event upgrade +type PrevEventRef struct { + PrevContent json.RawMessage `json:"prev_content"` + PrevID string `json:"replaces_state"` + PrevSender string `json:"prev_sender"` +} + // Response represents a /sync API response. See https://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-sync type Response struct { NextBatch string `json:"next_batch"`