aboutsummaryrefslogtreecommitdiffstats
path: root/cache/bug_cache.go
diff options
context:
space:
mode:
Diffstat (limited to 'cache/bug_cache.go')
-rw-r--r--cache/bug_cache.go13
1 files changed, 9 insertions, 4 deletions
diff --git a/cache/bug_cache.go b/cache/bug_cache.go
index 7503fc37..6caaeb11 100644
--- a/cache/bug_cache.go
+++ b/cache/bug_cache.go
@@ -5,7 +5,7 @@ import (
"sync"
"time"
- "github.com/MichaelMure/git-bug/bug"
+ "github.com/MichaelMure/git-bug/entities/bug"
"github.com/MichaelMure/git-bug/entity"
"github.com/MichaelMure/git-bug/entity/dag"
"github.com/MichaelMure/git-bug/repository"
@@ -209,7 +209,7 @@ func (c *BugCache) EditCreateCommentRaw(author *IdentityCache, unixTime int64, b
return op, c.notifyUpdated()
}
-func (c *BugCache) EditComment(target entity.Id, message string) (*bug.EditCommentOperation, error) {
+func (c *BugCache) EditComment(target entity.CombinedId, message string) (*bug.EditCommentOperation, error) {
author, err := c.repoCache.GetUserIdentity()
if err != nil {
return nil, err
@@ -218,9 +218,14 @@ func (c *BugCache) EditComment(target entity.Id, message string) (*bug.EditComme
return c.EditCommentRaw(author, time.Now().Unix(), target, message, nil)
}
-func (c *BugCache) EditCommentRaw(author *IdentityCache, unixTime int64, target entity.Id, message string, metadata map[string]string) (*bug.EditCommentOperation, error) {
+func (c *BugCache) EditCommentRaw(author *IdentityCache, unixTime int64, target entity.CombinedId, message string, metadata map[string]string) (*bug.EditCommentOperation, error) {
+ comment, err := c.Snapshot().SearchComment(target)
+ if err != nil {
+ return nil, err
+ }
+
c.mu.Lock()
- op, err := bug.EditComment(c.bug, author.Identity, unixTime, target, message, nil, metadata)
+ op, err := bug.EditComment(c.bug, author.Identity, unixTime, comment.TargetId(), message, nil, metadata)
c.mu.Unlock()
if err != nil {
return nil, err