diff options
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(), ) |