提交 e756b3b0 编写于 作者: M Mark Haines

Update gomatrixserverlib

上级 d63a1ddc
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
{ {
"importpath": "github.com/matrix-org/gomatrixserverlib", "importpath": "github.com/matrix-org/gomatrixserverlib",
"repository": "https://github.com/matrix-org/gomatrixserverlib", "repository": "https://github.com/matrix-org/gomatrixserverlib",
"revision": "8e7504f3b62366e621525c962314f53c045512e3", "revision": "785a53c41170526aa7a91a1fc534afac6ce01a9b",
"branch": "master" "branch": "master"
}, },
{ {
......
...@@ -119,6 +119,10 @@ func (eb *EventBuilder) Build(eventID string, now time.Time, origin ServerName, ...@@ -119,6 +119,10 @@ func (eb *EventBuilder) Build(eventID string, now time.Time, origin ServerName,
EventID string `json:"event_id"` EventID string `json:"event_id"`
OriginServerTS Timestamp `json:"origin_server_ts"` OriginServerTS Timestamp `json:"origin_server_ts"`
Origin ServerName `json:"origin"` Origin ServerName `json:"origin"`
// This key is either absent or an empty list.
// If it is absent then the pointer is nil and omitempty removes it.
// Otherwise it points to an empty list and omitempty keeps it.
PrevState *[]EventReference `json:"prev_state,omitempty"`
} }
event.EventBuilder = *eb event.EventBuilder = *eb
if event.PrevEvents == nil { if event.PrevEvents == nil {
...@@ -131,6 +135,16 @@ func (eb *EventBuilder) Build(eventID string, now time.Time, origin ServerName, ...@@ -131,6 +135,16 @@ func (eb *EventBuilder) Build(eventID string, now time.Time, origin ServerName,
event.Origin = origin event.Origin = origin
event.EventID = eventID event.EventID = eventID
if event.StateKey != nil {
// In early versions of the matrix protocol state events
// had a "prev_state" key that listed the state events with
// the same type and state key that this event replaced.
// This was later dropped from the protocol.
// Synapse ignores the contents of the key but still expects
// the key to be present in state events.
event.PrevState = &emptyEventReferenceList
}
// TODO: Check size limits. // TODO: Check size limits.
var eventJSON []byte var eventJSON []byte
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册