From e756b3b0ebfa5dd679f7ac6ca7dc8fa648707a50 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Mon, 22 May 2017 18:11:02 +0100 Subject: [PATCH] Update gomatrixserverlib --- vendor/manifest | 2 +- .../matrix-org/gomatrixserverlib/event.go | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/vendor/manifest b/vendor/manifest index 651491c6..c94ef195 100644 --- a/vendor/manifest +++ b/vendor/manifest @@ -98,7 +98,7 @@ { "importpath": "github.com/matrix-org/gomatrixserverlib", "repository": "https://github.com/matrix-org/gomatrixserverlib", - "revision": "8e7504f3b62366e621525c962314f53c045512e3", + "revision": "785a53c41170526aa7a91a1fc534afac6ce01a9b", "branch": "master" }, { diff --git a/vendor/src/github.com/matrix-org/gomatrixserverlib/event.go b/vendor/src/github.com/matrix-org/gomatrixserverlib/event.go index aa4f5b8c..f761727e 100644 --- a/vendor/src/github.com/matrix-org/gomatrixserverlib/event.go +++ b/vendor/src/github.com/matrix-org/gomatrixserverlib/event.go @@ -119,6 +119,10 @@ func (eb *EventBuilder) Build(eventID string, now time.Time, origin ServerName, EventID string `json:"event_id"` OriginServerTS Timestamp `json:"origin_server_ts"` 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 if event.PrevEvents == nil { @@ -131,6 +135,16 @@ func (eb *EventBuilder) Build(eventID string, now time.Time, origin ServerName, event.Origin = origin 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. var eventJSON []byte