diff options
author | Michael Muré <batolettre@gmail.com> | 2022-03-15 22:01:10 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2022-03-15 22:01:10 +0100 |
commit | c5b70d8d94bda20fb8834782ccdb1dbdfb85b052 (patch) | |
tree | 134b0417fd3db06967a8cbd29e42140fd24643cf /bug/operation.go | |
parent | cac20c8c4dc9524773c1296165fe596cb9035202 (diff) | |
download | git-bug-c5b70d8d94bda20fb8834782ccdb1dbdfb85b052.tar.gz |
bug: don't serialize multiple time the author, only once in OperationPack
Diffstat (limited to 'bug/operation.go')
-rw-r--r-- | bug/operation.go | 10 |
1 files changed, 1 insertions, 9 deletions
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 |