diff options
author | Michael Muré <batolettre@gmail.com> | 2022-04-19 21:47:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-19 21:47:15 +0200 |
commit | b8a799a97d1f3b743b19a9619785497706166a50 (patch) | |
tree | 60c2cb1ea2c30fce565bfe43668218f8f17647fa /bug/operation.go | |
parent | 450d7f7ade2496d4ecb8ae6906f53134c96ca7fb (diff) | |
parent | c5b70d8d94bda20fb8834782ccdb1dbdfb85b052 (diff) | |
download | git-bug-b8a799a97d1f3b743b19a9619785497706166a50.tar.gz |
Merge pull request #767 from MichaelMure/single-author
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 |