aboutsummaryrefslogtreecommitdiffstats
path: root/bug/operations/set_status.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-07-25 21:25:26 +0200
committerMichael Muré <batolettre@gmail.com>2018-07-25 21:27:50 +0200
commit6706fa2bebcf5e1ff7001dbe82a9d79fa33ac096 (patch)
treeca346f24125a2d6b13d10f06dd8ddc06b6a30917 /bug/operations/set_status.go
parent78355c887a9cc1b058a1bbc6ff38df54e34a96b4 (diff)
downloadgit-bug-6706fa2bebcf5e1ff7001dbe82a9d79fa33ac096.tar.gz
some cleaning
Diffstat (limited to 'bug/operations/set_status.go')
-rw-r--r--bug/operations/set_status.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/bug/operations/set_status.go b/bug/operations/set_status.go
index b62409dc..ed6c328c 100644
--- a/bug/operations/set_status.go
+++ b/bug/operations/set_status.go
@@ -13,6 +13,12 @@ type SetStatusOperation struct {
Status bug.Status
}
+func (op SetStatusOperation) Apply(snapshot bug.Snapshot) bug.Snapshot {
+ snapshot.Status = op.Status
+
+ return snapshot
+}
+
func NewSetStatusOp(author bug.Person, status bug.Status) SetStatusOperation {
return SetStatusOperation{
OpBase: bug.NewOpBase(bug.SetStatusOp, author),
@@ -20,17 +26,13 @@ func NewSetStatusOp(author bug.Person, status bug.Status) SetStatusOperation {
}
}
-func (op SetStatusOperation) Apply(snapshot bug.Snapshot) bug.Snapshot {
- snapshot.Status = op.Status
-
- return snapshot
-}
-
+// Convenience function to apply the operation
func Open(b *bug.Bug, author bug.Person) {
op := NewSetStatusOp(author, bug.OpenStatus)
b.Append(op)
}
+// Convenience function to apply the operation
func Close(b *bug.Bug, author bug.Person) {
op := NewSetStatusOp(author, bug.ClosedStatus)
b.Append(op)