aboutsummaryrefslogtreecommitdiffstats
path: root/cache/bug_excerpt.go
diff options
context:
space:
mode:
Diffstat (limited to 'cache/bug_excerpt.go')
-rw-r--r--cache/bug_excerpt.go15
1 files changed, 13 insertions, 2 deletions
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 {