From c5b70d8d94bda20fb8834782ccdb1dbdfb85b052 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Tue, 15 Mar 2022 22:01:10 +0100 Subject: bug: don't serialize multiple time the author, only once in OperationPack --- bug/operation.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'bug/operation.go') diff --git a/bug/operation.go b/bug/operation.go index 2e86921a..b5c6b1de 100644 --- a/bug/operation.go +++ b/bug/operation.go @@ -135,7 +135,7 @@ func operationUnmarshaller(author identity.Interface, raw json.RawMessage, resol // OpBase implement the common code for all operations type OpBase struct { OperationType OperationType `json:"type"` - Author_ identity.Interface `json:"author"` + Author_ identity.Interface `json:"-"` // not serialized // TODO: part of the data model upgrade, this should eventually be a timestamp + lamport UnixTime int64 `json:"timestamp"` Metadata map[string]string `json:"metadata,omitempty"` @@ -178,7 +178,6 @@ func (base *OpBase) UnmarshalJSON(data []byte) error { aux := struct { OperationType OperationType `json:"type"` - Author json.RawMessage `json:"author"` UnixTime int64 `json:"timestamp"` Metadata map[string]string `json:"metadata,omitempty"` Nonce []byte `json:"nonce"` @@ -188,14 +187,7 @@ func (base *OpBase) UnmarshalJSON(data []byte) error { return err } - // delegate the decoding of the identity - author, err := identity.UnmarshalJSON(aux.Author) - if err != nil { - return err - } - base.OperationType = aux.OperationType - base.Author_ = author base.UnixTime = aux.UnixTime base.Metadata = aux.Metadata base.Nonce = aux.Nonce -- cgit