aboutsummaryrefslogtreecommitdiffstats
path: root/cache
diff options
context:
space:
mode:
authorAmine Hilaly <hilalyamine@gmail.com>2019-06-15 02:50:09 +0200
committerAmine Hilaly <hilalyamine@gmail.com>2019-06-24 21:26:34 +0200
commit6451dd2928d7299dbcc3c34b3e6b8a8050f4c796 (patch)
tree37350fe4003addabf0764c7a7310baa98a636bb4 /cache
parent2f620e65b8edeb761a161cea0dda11eb1cdf8fec (diff)
downloadgit-bug-6451dd2928d7299dbcc3c34b3e6b8a8050f4c796.tar.gz
[cache] BugCache: Add set metadata methods
[bridge/github] fix add/remove mutation requests [bridge/github] iterator: fix typo
Diffstat (limited to 'cache')
-rw-r--r--cache/bug_cache.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/cache/bug_cache.go b/cache/bug_cache.go
index aad6dab8..36f2139e 100644
--- a/cache/bug_cache.go
+++ b/cache/bug_cache.go
@@ -254,6 +254,24 @@ func (c *BugCache) EditCommentRaw(author *IdentityCache, unixTime int64, target
return op, c.notifyUpdated()
}
+func (c *BugCache) SetMetadata(target git.Hash, newMetadata map[string]string) (*bug.SetMetadataOperation, error) {
+ author, err := c.repoCache.GetUserIdentity()
+ if err != nil {
+ return nil, err
+ }
+
+ return c.SetMetadataRaw(author, time.Now().Unix(), target, nil)
+}
+
+func (c *BugCache) SetMetadataRaw(author *IdentityCache, unixTime int64, target git.Hash, newMetadata map[string]string) (*bug.SetMetadataOperation, error) {
+ op, err := bug.SetMetadata(c.bug, author.Identity, unixTime, target, newMetadata)
+ if err != nil {
+ return nil, err
+ }
+
+ return op, c.notifyUpdated()
+}
+
func (c *BugCache) Commit() error {
err := c.bug.Commit(c.repoCache.repo)
if err != nil {