diff options
Diffstat (limited to 'cache')
-rw-r--r-- | cache/bug_excerpt.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cache/bug_excerpt.go b/cache/bug_excerpt.go index d78def4e..8e9e5e37 100644 --- a/cache/bug_excerpt.go +++ b/cache/bug_excerpt.go @@ -2,6 +2,7 @@ package cache import ( "encoding/gob" + "fmt" "github.com/MichaelMure/git-bug/bug" "github.com/MichaelMure/git-bug/identity" @@ -45,6 +46,19 @@ type LegacyAuthorExcerpt struct { Login string } +func (l LegacyAuthorExcerpt) DisplayName() string { + switch { + case l.Name == "" && l.Login != "": + return l.Login + case l.Name != "" && l.Login == "": + return l.Name + case l.Name != "" && l.Login != "": + return fmt.Sprintf("%s (%s)", l.Name, l.Login) + } + + panic("invalid person data") +} + func NewBugExcerpt(b bug.Interface, snap *bug.Snapshot) *BugExcerpt { participantsIds := make([]string, len(snap.Participants)) for i, participant := range snap.Participants { |