aboutsummaryrefslogtreecommitdiffstats
path: root/entities/bug/op_edit_comment.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2022-11-13 12:31:38 +0100
committerMichael Muré <batolettre@gmail.com>2022-11-13 12:31:38 +0100
commit3c6ebc2bfd50b72ff786a2cfd3bbdeb15b478dd3 (patch)
tree8cf4307bf48f016e0f8728c311bcc53ce38432e3 /entities/bug/op_edit_comment.go
parent55a2e8e4485fe63fbda759540958c7190dfeb85c (diff)
downloadgit-bug-3c6ebc2bfd50b72ff786a2cfd3bbdeb15b478dd3.tar.gz
core: bubble up the comment ID when created, or edited the first comment
Diffstat (limited to 'entities/bug/op_edit_comment.go')
-rw-r--r--entities/bug/op_edit_comment.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/entities/bug/op_edit_comment.go b/entities/bug/op_edit_comment.go
index b0897b0a..6ac09fd7 100644
--- a/entities/bug/op_edit_comment.go
+++ b/entities/bug/op_edit_comment.go
@@ -111,20 +111,20 @@ func NewEditCommentOp(author identity.Interface, unixTime int64, target entity.I
}
// EditComment is a convenience function to apply the operation
-func EditComment(b Interface, author identity.Interface, unixTime int64, target entity.Id, message string, files []repository.Hash, metadata map[string]string) (*EditCommentOperation, error) {
+func EditComment(b Interface, author identity.Interface, unixTime int64, target entity.Id, message string, files []repository.Hash, metadata map[string]string) (entity.CombinedId, *EditCommentOperation, error) {
op := NewEditCommentOp(author, unixTime, target, message, files)
for key, val := range metadata {
op.SetMetadata(key, val)
}
if err := op.Validate(); err != nil {
- return nil, err
+ return entity.UnsetCombinedId, nil, err
}
b.Append(op)
- return op, nil
+ return entity.CombineIds(b.Id(), target), op, nil
}
// EditCreateComment is a convenience function to edit the body of a bug (the first comment)
-func EditCreateComment(b Interface, author identity.Interface, unixTime int64, message string, files []repository.Hash, metadata map[string]string) (*EditCommentOperation, error) {
+func EditCreateComment(b Interface, author identity.Interface, unixTime int64, message string, files []repository.Hash, metadata map[string]string) (entity.CombinedId, *EditCommentOperation, error) {
createOp := b.FirstOp().(*CreateOperation)
return EditComment(b, author, unixTime, createOp.Id(), message, files, metadata)
}