mirror of
https://github.com/taigrr/wtf
synced 2026-03-22 20:32:18 -07:00
Display names instead of emails in OpsGenie widget
This commit is contained in:
committed by
Chris Cummer
parent
5c9da163b2
commit
8c856477e1
@@ -61,9 +61,20 @@ func (widget *Widget) contentFrom(onCallResponse *OnCallResponse) string {
|
||||
|
||||
for _, data := range onCallResponse.OnCallData {
|
||||
str = str + fmt.Sprintf(" [green]%s[white]\n", data.Parent.Name)
|
||||
str = str + fmt.Sprintf(" %s\n", strings.Join(data.Recipients, ", "))
|
||||
str = str + fmt.Sprintf(" %s\n", strings.Join(widget.namesFromEmails(data.Recipients), ", "))
|
||||
str = str + "\n"
|
||||
}
|
||||
|
||||
return str
|
||||
}
|
||||
|
||||
func (widget *Widget) namesFromEmails(emails []string) []string {
|
||||
names := []string{}
|
||||
|
||||
for _, email := range emails {
|
||||
parts := strings.Split(email, "@")
|
||||
names = append(names, strings.Title(strings.Replace(parts[0], ".", " ", -1)))
|
||||
}
|
||||
|
||||
return names
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user