aboutsummaryrefslogtreecommitdiffstats
path: root/cache
diff options
context:
space:
mode:
Diffstat (limited to 'cache')
-rw-r--r--cache/bug_cache.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/cache/bug_cache.go b/cache/bug_cache.go
index 6026190f..b86b31e0 100644
--- a/cache/bug_cache.go
+++ b/cache/bug_cache.go
@@ -210,6 +210,28 @@ func (c *BugCache) SetTitleRaw(author *IdentityCache, unixTime int64, title stri
return op, c.notifyUpdated()
}
+func (c *BugCache) EditCreateComment(body string) (*bug.EditCommentOperation, error) {
+ author, err := c.repoCache.GetUserIdentity()
+ if err != nil {
+ return nil, err
+ }
+
+ return c.EditCreateCommentRaw(author, time.Now().Unix(), body, nil)
+}
+
+func (c *BugCache) EditCreateCommentRaw(author *IdentityCache, unixTime int64, body string, metadata map[string]string) (*bug.EditCommentOperation, error) {
+ op, err := bug.EditCreateComment(c.bug, author.Identity, unixTime, body)
+ if err != nil {
+ return nil, err
+ }
+
+ for key, value := range metadata {
+ op.SetMetadata(key, value)
+ }
+
+ return op, c.notifyUpdated()
+}
+
func (c *BugCache) EditComment(target entity.Id, message string) (*bug.EditCommentOperation, error) {
author, err := c.repoCache.GetUserIdentity()
if err != nil {