diff options
author | Michael Muré <batolettre@gmail.com> | 2020-10-04 20:57:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-04 20:57:54 +0200 |
commit | c738852af0b8b1013c7911f2c3d275446d9e8936 (patch) | |
tree | 0ebfbc122240736292338275a5b599abaa7d710b /commands/ls.go | |
parent | 5d1fc3ff393133a8aa67b97f9beecfe9b57c7e56 (diff) | |
parent | 499dbc0a032ff28eea99e5308be9b6c8f2d208ad (diff) | |
download | git-bug-c738852af0b8b1013c7911f2c3d275446d9e8936.tar.gz |
Merge pull request #417 from MichaelMure/remove-legacy-identity
identity: remove support for legacy identity
Diffstat (limited to 'commands/ls.go')
-rw-r--r-- | commands/ls.go | 40 |
1 files changed, 12 insertions, 28 deletions
diff --git a/commands/ls.go b/commands/ls.go index 9eaabb12..fa653378 100644 --- a/commands/ls.go +++ b/commands/ls.go @@ -151,15 +151,11 @@ func lsJsonFormatter(env *Env, bugExcerpts []*cache.BugExcerpt) error { Metadata: b.CreateMetadata, } - if b.AuthorId != "" { - author, err := env.backend.ResolveIdentityExcerpt(b.AuthorId) - if err != nil { - return err - } - jsonBug.Author = NewJSONIdentityFromExcerpt(author) - } else { - jsonBug.Author = NewJSONIdentityFromLegacyExcerpt(&b.LegacyAuthor) + author, err := env.backend.ResolveIdentityExcerpt(b.AuthorId) + if err != nil { + return err } + jsonBug.Author = NewJSONIdentityFromExcerpt(author) jsonBug.Actors = make([]JSONIdentity, len(b.Actors)) for i, element := range b.Actors { @@ -188,15 +184,9 @@ func lsJsonFormatter(env *Env, bugExcerpts []*cache.BugExcerpt) error { func lsDefaultFormatter(env *Env, bugExcerpts []*cache.BugExcerpt) error { for _, b := range bugExcerpts { - var name string - if b.AuthorId != "" { - author, err := env.backend.ResolveIdentityExcerpt(b.AuthorId) - if err != nil { - return err - } - name = author.DisplayName() - } else { - name = b.LegacyAuthor.DisplayName() + author, err := env.backend.ResolveIdentityExcerpt(b.AuthorId) + if err != nil { + return err } var labelsTxt strings.Builder @@ -210,7 +200,7 @@ func lsDefaultFormatter(env *Env, bugExcerpts []*cache.BugExcerpt) error { // truncate + pad if needed labelsFmt := text.TruncateMax(labelsTxt.String(), 10) titleFmt := text.LeftPadMaxLine(strings.TrimSpace(b.Title), 50-text.Len(labelsFmt), 0) - authorFmt := text.LeftPadMaxLine(name, 15, 0) + authorFmt := text.LeftPadMaxLine(author.DisplayName(), 15, 0) comments := fmt.Sprintf("%3d 💬", b.LenComments-1) if b.LenComments-1 <= 0 { @@ -261,15 +251,9 @@ func lsOrgmodeFormatter(env *Env, bugExcerpts []*cache.BugExcerpt) error { title = b.Title } - var name string - if b.AuthorId != "" { - author, err := env.backend.ResolveIdentityExcerpt(b.AuthorId) - if err != nil { - return err - } - name = author.DisplayName() - } else { - name = b.LegacyAuthor.DisplayName() + author, err := env.backend.ResolveIdentityExcerpt(b.AuthorId) + if err != nil { + return err } var labels strings.Builder @@ -286,7 +270,7 @@ func lsOrgmodeFormatter(env *Env, bugExcerpts []*cache.BugExcerpt) error { status, b.Id.Human(), formatTime(b.CreateTime()), - name, + author.DisplayName(), title, labels.String(), ) |