set_status.go

 1package operations
 2
 3import (
 4	"github.com/MichaelMure/git-bug/bug"
 5)
 6
 7// SetStatusOperation will change the status of a bug
 8
 9var _ bug.Operation = SetStatusOperation{}
10
11type SetStatusOperation struct {
12	bug.OpBase
13	Status bug.Status
14}
15
16func NewSetStatusOp(author bug.Person, status bug.Status) SetStatusOperation {
17	return SetStatusOperation{
18		OpBase: bug.NewOpBase(bug.SetStatusOp, author),
19		Status: status,
20	}
21}
22
23func (op SetStatusOperation) Apply(snapshot bug.Snapshot) bug.Snapshot {
24	snapshot.Status = op.Status
25
26	return snapshot
27}