mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-07 06:53:09 -06:00
More comments
This commit is contained in:
parent
e7f859978a
commit
32af06fff8
|
|
@ -45,6 +45,8 @@ type InputRoomEvent struct {
|
||||||
HasState bool
|
HasState bool
|
||||||
// Optional list of state event IDs forming the state before this event.
|
// Optional list of state event IDs forming the state before this event.
|
||||||
// These state events must have already been persisted.
|
// These state events must have already been persisted.
|
||||||
|
// These are only used if HasState is true.
|
||||||
|
// The list can be empty, for example when storing a m.room.create event.
|
||||||
StateEventIDs []string
|
StateEventIDs []string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -52,6 +54,8 @@ type InputRoomEvent struct {
|
||||||
func (ire *InputRoomEvent) UnmarshalJSON(data []byte) error {
|
func (ire *InputRoomEvent) UnmarshalJSON(data []byte) error {
|
||||||
// Create a struct rather than unmarshalling directly into the InputRoomEvent
|
// Create a struct rather than unmarshalling directly into the InputRoomEvent
|
||||||
// so that we can use json.RawMessage.
|
// so that we can use json.RawMessage.
|
||||||
|
// We use json.RawMessage so that the event JSON is sent as JSON rather than
|
||||||
|
// being base64 encoded which is the default for []byte.
|
||||||
var content struct {
|
var content struct {
|
||||||
Kind int
|
Kind int
|
||||||
Event *json.RawMessage
|
Event *json.RawMessage
|
||||||
|
|
@ -76,6 +80,8 @@ func (ire *InputRoomEvent) UnmarshalJSON(data []byte) error {
|
||||||
func (ire InputRoomEvent) MarshalJSON() ([]byte, error) {
|
func (ire InputRoomEvent) MarshalJSON() ([]byte, error) {
|
||||||
// Create a struct rather than marshalling directly from the InputRoomEvent
|
// Create a struct rather than marshalling directly from the InputRoomEvent
|
||||||
// so that we can use json.RawMessage.
|
// so that we can use json.RawMessage.
|
||||||
|
// We use json.RawMessage so that the event JSON is sent as JSON rather than
|
||||||
|
// being base64 encoded which is the default for []byte.
|
||||||
event := json.RawMessage(ire.Event)
|
event := json.RawMessage(ire.Event)
|
||||||
content := struct {
|
content := struct {
|
||||||
Kind int
|
Kind int
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue