Skip to content

Commit

Permalink
[Dembo|Hadrian.Siregar] Change order of message content for slack
Browse files Browse the repository at this point in the history
  • Loading branch information
walbertus committed Oct 24, 2019
1 parent fce7752 commit 8ee8810
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion plugins/slack-notification-plugin/slack/message/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/json"
"errors"
"proctor/pkg/notification/event"
"sort"
)

type executionMessage struct {
Expand All @@ -26,7 +27,14 @@ func (messageObject *executionMessage) JSON() (string, error) {
Text: userEmail + " execute job with details:",
}
section.Fields = []textComponent{}
for key, value := range evt.Content() {
contents := evt.Content()
var keys []string
for key := range contents {
keys = append(keys, key)
}
sort.Strings(keys)
for _, key := range keys {
value := contents[key]
keyComponent := textComponent{}
keyComponent.Type = "mrkdwn"
keyComponent.Text = "*" + key + "*"
Expand Down

0 comments on commit 8ee8810

Please sign in to comment.