aboutsummaryrefslogtreecommitdiffstats
path: root/bug/op_add_comment.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2022-07-31 14:38:32 +0200
committerMichael Muré <batolettre@gmail.com>2022-07-31 14:38:32 +0200
commitd179b8b7ec7815ccac73e00f35f5cfbdc4ddbe2e (patch)
treed3faa7217cb287c7b20f2769f5c5808373aca63b /bug/op_add_comment.go
parent3d454d9dc8ba2409046c0938618a70864e6eb8ef (diff)
downloadgit-bug-d179b8b7ec7815ccac73e00f35f5cfbdc4ddbe2e.tar.gz
bug: fix an issue where Id would be used, then changed due to metadata
Diffstat (limited to 'bug/op_add_comment.go')
-rw-r--r--bug/op_add_comment.go19
1 files changed, 9 insertions, 10 deletions
diff --git a/bug/op_add_comment.go b/bug/op_add_comment.go
index b11afe34..eddd585a 100644
--- a/bug/op_add_comment.go
+++ b/bug/op_add_comment.go
@@ -79,16 +79,15 @@ type AddCommentTimelineItem struct {
// IsAuthored is a sign post method for gqlgen
func (a *AddCommentTimelineItem) IsAuthored() {}
-// Convenience function to apply the operation
-func AddComment(b Interface, author identity.Interface, unixTime int64, message string) (*AddCommentOperation, error) {
- return AddCommentWithFiles(b, author, unixTime, message, nil)
-}
-
-func AddCommentWithFiles(b Interface, author identity.Interface, unixTime int64, message string, files []repository.Hash) (*AddCommentOperation, error) {
- addCommentOp := NewAddCommentOp(author, unixTime, message, files)
- if err := addCommentOp.Validate(); err != nil {
+// AddComment is a convenience function to add a comment to a bug
+func AddComment(b Interface, author identity.Interface, unixTime int64, message string, files []repository.Hash, metadata map[string]string) (*AddCommentOperation, error) {
+ op := NewAddCommentOp(author, unixTime, message, files)
+ for key, val := range metadata {
+ op.SetMetadata(key, val)
+ }
+ if err := op.Validate(); err != nil {
return nil, err
}
- b.Append(addCommentOp)
- return addCommentOp, nil
+ b.Append(op)
+ return op, nil
}