mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-12 09:23:09 -06:00
Move prev event structure to component-wide types
This commit is contained in:
parent
b9a933846b
commit
225f671a93
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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"`
|
||||
|
|
|
|||
Loading…
Reference in a new issue