From 74e91144105790cc997c1d79a7f638e1e3a1f3f8 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Fri, 24 Jan 2020 00:30:13 +0100 Subject: more more wip --- cache/identity_excerpt.go | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'cache/identity_excerpt.go') diff --git a/cache/identity_excerpt.go b/cache/identity_excerpt.go index 18514e9a..06788aa5 100644 --- a/cache/identity_excerpt.go +++ b/cache/identity_excerpt.go @@ -2,7 +2,6 @@ package cache import ( "encoding/gob" - "fmt" "strings" "github.com/MichaelMure/git-bug/entity" @@ -21,7 +20,6 @@ type IdentityExcerpt struct { Id entity.Id Name string - Login string ImmutableMetadata map[string]string } @@ -29,7 +27,6 @@ func NewIdentityExcerpt(i *identity.Identity) *IdentityExcerpt { return &IdentityExcerpt{ Id: i.Id(), Name: i.Name(), - Login: i.Login(), ImmutableMetadata: i.ImmutableMetadata(), } } @@ -37,23 +34,13 @@ func NewIdentityExcerpt(i *identity.Identity) *IdentityExcerpt { // DisplayName return a non-empty string to display, representing the // identity, based on the non-empty values. func (i *IdentityExcerpt) DisplayName() string { - switch { - case i.Name == "" && i.Login != "": - return i.Login - case i.Name != "" && i.Login == "": - return i.Name - case i.Name != "" && i.Login != "": - return fmt.Sprintf("%s (%s)", i.Name, i.Login) - } - - panic("invalid person data") + return i.Name } // Match matches a query with the identity name, login and ID prefixes func (i *IdentityExcerpt) Match(query string) bool { return i.Id.HasPrefix(query) || - strings.Contains(strings.ToLower(i.Name), query) || - strings.Contains(strings.ToLower(i.Login), query) + strings.Contains(strings.ToLower(i.Name), query) } /* -- cgit