set_status.go

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