From 893de4f5c0e852fac9a73e0c0243bc038af75f17 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Tue, 25 Feb 2020 21:35:57 +0100 Subject: identity: bring back the login to hold that info from bridges (purely informational) --- cache/bug_excerpt.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'cache/bug_excerpt.go') diff --git a/cache/bug_excerpt.go b/cache/bug_excerpt.go index 10e522f9..d0d0aa60 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/entity" @@ -42,11 +43,21 @@ type BugExcerpt struct { // identity.Bare data are directly embedded in the bug excerpt type LegacyAuthorExcerpt struct { - Name string + Name string + Login string } func (l LegacyAuthorExcerpt) DisplayName() string { - return l.Name + 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 { -- cgit