aboutsummaryrefslogtreecommitdiffstats
path: root/bug/op_add_comment.go
diff options
context:
space:
mode:
Diffstat (limited to 'bug/op_add_comment.go')
-rw-r--r--bug/op_add_comment.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/bug/op_add_comment.go b/bug/op_add_comment.go
index 9ecef941..c1e0838b 100644
--- a/bug/op_add_comment.go
+++ b/bug/op_add_comment.go
@@ -29,7 +29,15 @@ func (op *AddCommentOperation) Hash() (git.Hash, error) {
}
func (op *AddCommentOperation) Apply(snapshot *Snapshot) {
+ hash, err := op.Hash()
+ if err != nil {
+ // Should never error unless a programming error happened
+ // (covered in OpBase.Validate())
+ panic(err)
+ }
+
comment := Comment{
+ id: string(hash),
Message: op.Message,
Author: op.Author,
Files: op.Files,
@@ -38,13 +46,6 @@ func (op *AddCommentOperation) Apply(snapshot *Snapshot) {
snapshot.Comments = append(snapshot.Comments, comment)
- hash, err := op.Hash()
- if err != nil {
- // Should never error unless a programming error happened
- // (covered in OpBase.Validate())
- panic(err)
- }
-
item := &AddCommentTimelineItem{
CommentTimelineItem: NewCommentTimelineItem(hash, comment),
}