aboutsummaryrefslogtreecommitdiffstats
path: root/cache/bug_excerpt.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2019-04-11 20:04:44 +0200
committerMichael Muré <batolettre@gmail.com>2019-04-11 20:04:44 +0200
commit5eeeae7cdf24083277076041c4e8cdc6b4737fda (patch)
tree0e1e8b6a44650a146a296b3710757c309d420617 /cache/bug_excerpt.go
parent4fac4abbcd357b9a8a99222af15a7c5fca9f5633 (diff)
downloadgit-bug-5eeeae7cdf24083277076041c4e8cdc6b4737fda.tar.gz
commands: fix ls not displaying the new Identities properly
Diffstat (limited to 'cache/bug_excerpt.go')
-rw-r--r--cache/bug_excerpt.go14
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 {