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
|
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.
|
// NewOutputRoomEvent creates a new OutputRoomEvent consumer. Call Start() to begin consuming from room servers.
|
||||||
func NewOutputRoomEvent(
|
func NewOutputRoomEvent(
|
||||||
cfg *config.Dendrite,
|
cfg *config.Dendrite,
|
||||||
|
|
@ -267,10 +261,10 @@ func (s *OutputRoomEvent) updateStateEvent(event gomatrixserverlib.Event) (gomat
|
||||||
return event, nil
|
return event, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
prev := prevEventRef{
|
prev := types.PrevEventRef{
|
||||||
PrevContent: prevEvent.Content(),
|
PrevContent: prevEvent.Content(),
|
||||||
PrevID: prevEvent.EventID(),
|
PrevID: prevEvent.EventID(),
|
||||||
UserID: prevEvent.Sender(),
|
PrevSender: prevEvent.Sender(),
|
||||||
}
|
}
|
||||||
|
|
||||||
return event.SetUnsigned(prev)
|
return event.SetUnsigned(prev)
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
package types
|
package types
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
|
|
@ -28,6 +29,13 @@ func (sp StreamPosition) String() string {
|
||||||
return strconv.FormatInt(int64(sp), 10)
|
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
|
// 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 {
|
type Response struct {
|
||||||
NextBatch string `json:"next_batch"`
|
NextBatch string `json:"next_batch"`
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue