From 3403eb19a5502f1e8a1968bf0071161d94951661 Mon Sep 17 00:00:00 2001 From: Finn Date: Sun, 28 Mar 2021 22:06:36 -0700 Subject: [PATCH] Add profile name to group show --- cmd/signaldctl/cmd/group/show/show-group.go | 30 ++++++++++++++------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/cmd/signaldctl/cmd/group/show/show-group.go b/cmd/signaldctl/cmd/group/show/show-group.go index 2e1b274..61584ad 100644 --- a/cmd/signaldctl/cmd/group/show/show-group.go +++ b/cmd/signaldctl/cmd/group/show/show-group.go @@ -83,18 +83,30 @@ var ( } fmt.Println("Members") - membere164s := make(map[string]string) - for _, member := range group.Members { - if member.Number == "" { - continue - } - membere164s[member.UUID] = member.Number - } + // membere164s := make(map[string]string) + // for _, member := range group.Members { + // if member.Number == "" { + // continue + // } + // membere164s[member.UUID] = member.Number + // } t := table.NewWriter() - t.AppendHeader(table.Row{"Number", "UUID", "Role"}) + t.AppendHeader(table.Row{"Number", "UUID", "Name", "Role"}) for _, member := range group.MemberDetail { - t.AppendRow(table.Row{membere164s[member.UUID], member.UUID, member.Role}) + req := v1.GetProfileRequest{ + Account: account, + Address: &v1.JsonAddress{UUID: member.UUID}, + Async: true, + } + e164 := "" + profile, err := req.Submit(common.Signald) + if err != nil { + log.Println("error getting profile: ", err) + } else { + e164 = profile.Address.Number + } + t.AppendRow(table.Row{e164, member.UUID, profile.ProfileName, member.Role}) } t.SetOutputMirror(os.Stdout) common.StylizeTable(t)