aboutsummaryrefslogtreecommitdiffstats
path: root/bug/operations/add_comment.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-07-18 00:16:06 +0200
committerMichael Muré <batolettre@gmail.com>2018-07-18 00:16:06 +0200
commitba3281dc9918fa49f10c2a166b5b631a931d2d51 (patch)
treef6e9d17fa7828634f250c7af0674d5405ba0d224 /bug/operations/add_comment.go
parent6f83d89274fc796e01149c84b91b8aa2066f0273 (diff)
downloadgit-bug-ba3281dc9918fa49f10c2a166b5b631a931d2d51.tar.gz
all operations now have an author and a timestamp
Diffstat (limited to 'bug/operations/add_comment.go')
-rw-r--r--bug/operations/add_comment.go15
1 files changed, 6 insertions, 9 deletions
diff --git a/bug/operations/add_comment.go b/bug/operations/add_comment.go
index 2927295a..9ee8dc64 100644
--- a/bug/operations/add_comment.go
+++ b/bug/operations/add_comment.go
@@ -2,32 +2,29 @@ package operations
import (
"github.com/MichaelMure/git-bug/bug"
- "time"
)
+// AddCommentOperation will add a new comment in the bug
+
var _ bug.Operation = AddCommentOperation{}
type AddCommentOperation struct {
bug.OpBase
Message string
- Author bug.Person
- Time int64
}
func NewAddCommentOp(author bug.Person, message string) AddCommentOperation {
return AddCommentOperation{
- OpBase: bug.OpBase{OperationType: bug.AddCommentOp},
+ OpBase: bug.NewOpBase(bug.AddCommentOp, author),
Message: message,
- Author: author,
- Time: time.Now().Unix(),
}
}
func (op AddCommentOperation) Apply(snapshot bug.Snapshot) bug.Snapshot {
comment := bug.Comment{
- Message: op.Message,
- Author: op.Author,
- Time: op.Time,
+ Message: op.Message,
+ Author: op.Author,
+ UnixTime: op.UnixTime,
}
snapshot.Comments = append(snapshot.Comments, comment)