diff options
author | Amine Hilaly <hilalyamine@gmail.com> | 2019-06-15 02:50:09 +0200 |
---|---|---|
committer | Amine Hilaly <hilalyamine@gmail.com> | 2019-06-24 21:26:34 +0200 |
commit | 6451dd2928d7299dbcc3c34b3e6b8a8050f4c796 (patch) | |
tree | 37350fe4003addabf0764c7a7310baa98a636bb4 /cache/bug_cache.go | |
parent | 2f620e65b8edeb761a161cea0dda11eb1cdf8fec (diff) | |
download | git-bug-6451dd2928d7299dbcc3c34b3e6b8a8050f4c796.tar.gz git-bug-6451dd2928d7299dbcc3c34b3e6b8a8050f4c796.zip |
[cache] BugCache: Add set metadata methods
[bridge/github] fix add/remove mutation requests
[bridge/github] iterator: fix typo
Diffstat (limited to 'cache/bug_cache.go')
-rw-r--r-- | cache/bug_cache.go | 18 |
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 { |