diff options
author | Michael Muré <batolettre@gmail.com> | 2018-09-29 20:41:19 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-09-29 20:41:19 +0200 |
commit | c46d01f8c10e6363b680fa6876e91bd8eaf3bb3e (patch) | |
tree | dde41c1253534bf4ff36e39454f2bdbdf4b9590f /bug/op_set_status.go | |
parent | 41e61a67b63e4d6c517005cf6f427115a664bdb5 (diff) | |
download | git-bug-c46d01f8c10e6363b680fa6876e91bd8eaf3bb3e.tar.gz |
bug: implement comment edition
- add a new operation
- add a new "timeline" in the snapshot that hold a processed version of the operations
Diffstat (limited to 'bug/op_set_status.go')
-rw-r--r-- | bug/op_set_status.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/bug/op_set_status.go b/bug/op_set_status.go index 1fb9cab6..cdfa25e7 100644 --- a/bug/op_set_status.go +++ b/bug/op_set_status.go @@ -5,28 +5,28 @@ import ( "github.com/pkg/errors" ) -// SetStatusOperation will change the status of a bug - -var _ Operation = SetStatusOperation{} +var _ Operation = &SetStatusOperation{} +// SetStatusOperation will change the status of a bug type SetStatusOperation struct { *OpBase Status Status `json:"status"` } -func (op SetStatusOperation) base() *OpBase { +func (op *SetStatusOperation) base() *OpBase { return op.OpBase } -func (op SetStatusOperation) Hash() (git.Hash, error) { +func (op *SetStatusOperation) Hash() (git.Hash, error) { return hashOperation(op) } -func (op SetStatusOperation) Apply(snapshot *Snapshot) { +func (op *SetStatusOperation) Apply(snapshot *Snapshot) { snapshot.Status = op.Status + snapshot.Timeline = append(snapshot.Timeline, op) } -func (op SetStatusOperation) Validate() error { +func (op *SetStatusOperation) Validate() error { if err := opBaseValidate(op, SetStatusOp); err != nil { return err } @@ -38,8 +38,8 @@ func (op SetStatusOperation) Validate() error { return nil } -func NewSetStatusOp(author Person, unixTime int64, status Status) SetStatusOperation { - return SetStatusOperation{ +func NewSetStatusOp(author Person, unixTime int64, status Status) *SetStatusOperation { + return &SetStatusOperation{ OpBase: newOpBase(SetStatusOp, author, unixTime), Status: status, } |