diff options
author | Michael Muré <batolettre@gmail.com> | 2022-11-19 11:33:12 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2022-11-28 17:20:25 +0100 |
commit | 0ac39a7ab5db077fcf0df827e32bf6e625e980da (patch) | |
tree | e453d6fd244cb322bdc6305c0088aa3c0331b075 /cache/identity_excerpt.go | |
parent | c6bb6b9c7ecddb679966b1561e2e909a9ee5e8cd (diff) | |
download | git-bug-0ac39a7ab5db077fcf0df827e32bf6e625e980da.tar.gz |
WIP
Diffstat (limited to 'cache/identity_excerpt.go')
-rw-r--r-- | cache/identity_excerpt.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/cache/identity_excerpt.go b/cache/identity_excerpt.go index 0166f493..126c712b 100644 --- a/cache/identity_excerpt.go +++ b/cache/identity_excerpt.go @@ -18,7 +18,7 @@ func init() { // filter identities efficiently without having to read and compile each raw // identity. type IdentityExcerpt struct { - Id entity.Id + id entity.Id Name string Login string @@ -27,13 +27,17 @@ type IdentityExcerpt struct { func NewIdentityExcerpt(i *identity.Identity) *IdentityExcerpt { return &IdentityExcerpt{ - Id: i.Id(), + id: i.Id(), Name: i.Name(), Login: i.Login(), ImmutableMetadata: i.ImmutableMetadata(), } } +func (i *IdentityExcerpt) Id() entity.Id { + return i.id +} + // DisplayName return a non-empty string to display, representing the // identity, based on the non-empty values. func (i *IdentityExcerpt) DisplayName() string { @@ -51,7 +55,7 @@ func (i *IdentityExcerpt) DisplayName() string { // Match matches a query with the identity name, login and ID prefixes func (i *IdentityExcerpt) Match(query string) bool { - return i.Id.HasPrefix(query) || + return i.id.HasPrefix(query) || strings.Contains(strings.ToLower(i.Name), query) || strings.Contains(strings.ToLower(i.Login), query) } @@ -67,7 +71,7 @@ func (b IdentityById) Len() int { } func (b IdentityById) Less(i, j int) bool { - return b[i].Id < b[j].Id + return b[i].id < b[j].id } func (b IdentityById) Swap(i, j int) { |