aboutsummaryrefslogtreecommitdiffstats
path: root/cache
diff options
context:
space:
mode:
Diffstat (limited to 'cache')
-rw-r--r--cache/bug_cache.go12
-rw-r--r--cache/bug_excerpt.go18
-rw-r--r--cache/filter.go7
-rw-r--r--cache/repo_cache.go2
4 files changed, 25 insertions, 14 deletions
diff --git a/cache/bug_cache.go b/cache/bug_cache.go
index 53c5c7d9..53c1db64 100644
--- a/cache/bug_cache.go
+++ b/cache/bug_cache.go
@@ -93,7 +93,7 @@ func (c *BugCache) AddComment(message string) error {
}
func (c *BugCache) AddCommentWithFiles(message string, files []git.Hash) error {
- author, err := identity.GetIdentity(c.repoCache.repo)
+ author, err := identity.GetUserIdentity(c.repoCache.repo)
if err != nil {
return err
}
@@ -115,7 +115,7 @@ func (c *BugCache) AddCommentRaw(author *identity.Identity, unixTime int64, mess
}
func (c *BugCache) ChangeLabels(added []string, removed []string) ([]bug.LabelChangeResult, error) {
- author, err := identity.GetIdentity(c.repoCache.repo)
+ author, err := identity.GetUserIdentity(c.repoCache.repo)
if err != nil {
return nil, err
}
@@ -142,7 +142,7 @@ func (c *BugCache) ChangeLabelsRaw(author *identity.Identity, unixTime int64, ad
}
func (c *BugCache) Open() error {
- author, err := identity.GetIdentity(c.repoCache.repo)
+ author, err := identity.GetUserIdentity(c.repoCache.repo)
if err != nil {
return err
}
@@ -164,7 +164,7 @@ func (c *BugCache) OpenRaw(author *identity.Identity, unixTime int64, metadata m
}
func (c *BugCache) Close() error {
- author, err := identity.GetIdentity(c.repoCache.repo)
+ author, err := identity.GetUserIdentity(c.repoCache.repo)
if err != nil {
return err
}
@@ -186,7 +186,7 @@ func (c *BugCache) CloseRaw(author *identity.Identity, unixTime int64, metadata
}
func (c *BugCache) SetTitle(title string) error {
- author, err := identity.GetIdentity(c.repoCache.repo)
+ author, err := identity.GetUserIdentity(c.repoCache.repo)
if err != nil {
return err
}
@@ -208,7 +208,7 @@ func (c *BugCache) SetTitleRaw(author *identity.Identity, unixTime int64, title
}
func (c *BugCache) EditComment(target git.Hash, message string) error {
- author, err := identity.GetIdentity(c.repoCache.repo)
+ author, err := identity.GetUserIdentity(c.repoCache.repo)
if err != nil {
return err
}
diff --git a/cache/bug_excerpt.go b/cache/bug_excerpt.go
index f5844b64..daf89c4f 100644
--- a/cache/bug_excerpt.go
+++ b/cache/bug_excerpt.go
@@ -3,8 +3,6 @@ package cache
import (
"encoding/gob"
- "github.com/MichaelMure/git-bug/identity"
-
"github.com/MichaelMure/git-bug/bug"
"github.com/MichaelMure/git-bug/util/lamport"
)
@@ -20,12 +18,17 @@ type BugExcerpt struct {
EditUnixTime int64
Status bug.Status
- Author identity.Interface
+ Author AuthorExcerpt
Labels []bug.Label
CreateMetadata map[string]string
}
+type AuthorExcerpt struct {
+ Name string
+ Login string
+}
+
func NewBugExcerpt(b bug.Interface, snap *bug.Snapshot) *BugExcerpt {
return &BugExcerpt{
Id: b.Id(),
@@ -34,9 +37,12 @@ func NewBugExcerpt(b bug.Interface, snap *bug.Snapshot) *BugExcerpt {
CreateUnixTime: b.FirstOp().GetUnixTime(),
EditUnixTime: snap.LastEditUnix(),
Status: snap.Status,
- Author: snap.Author,
- Labels: snap.Labels,
- CreateMetadata: b.FirstOp().AllMetadata(),
+ Author: AuthorExcerpt{
+ Login: snap.Author.Login(),
+ Name: snap.Author.Name(),
+ },
+ Labels: snap.Labels,
+ CreateMetadata: b.FirstOp().AllMetadata(),
}
}
diff --git a/cache/filter.go b/cache/filter.go
index 033df131..3cf4a991 100644
--- a/cache/filter.go
+++ b/cache/filter.go
@@ -1,6 +1,8 @@
package cache
import (
+ "strings"
+
"github.com/MichaelMure/git-bug/bug"
)
@@ -22,7 +24,10 @@ func StatusFilter(query string) (Filter, error) {
// AuthorFilter return a Filter that match a bug author
func AuthorFilter(query string) Filter {
return func(excerpt *BugExcerpt) bool {
- return excerpt.Author.Match(query)
+ query = strings.ToLower(query)
+
+ return strings.Contains(strings.ToLower(excerpt.Author.Name), query) ||
+ strings.Contains(strings.ToLower(excerpt.Author.Login), query)
}
}
diff --git a/cache/repo_cache.go b/cache/repo_cache.go
index e1a3d8f8..3d8b352b 100644
--- a/cache/repo_cache.go
+++ b/cache/repo_cache.go
@@ -394,7 +394,7 @@ func (c *RepoCache) NewBug(title string, message string) (*BugCache, error) {
// NewBugWithFiles create a new bug with attached files for the message
// The new bug is written in the repository (commit)
func (c *RepoCache) NewBugWithFiles(title string, message string, files []git.Hash) (*BugCache, error) {
- author, err := identity.GetIdentity(c.repo)
+ author, err := identity.GetUserIdentity(c.repo)
if err != nil {
return nil, err
}