aboutsummaryrefslogtreecommitdiffstats
path: root/cache/bug_excerpt.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2020-02-25 21:35:57 +0100
committerMichael Muré <batolettre@gmail.com>2020-02-25 21:35:57 +0100
commit893de4f5c0e852fac9a73e0c0243bc038af75f17 (patch)
tree6129d0a6e2efbfa81b26534ee5aeb65ba1261bfe /cache/bug_excerpt.go
parent68acfa519ab6656648d1e976db2a4190bbeb5f44 (diff)
downloadgit-bug-893de4f5c0e852fac9a73e0c0243bc038af75f17.tar.gz
identity: bring back the login to hold that info from bridges (purely informational)
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 {