From 8ee8810f3568d8878b75bcda21e039ebc60d601d Mon Sep 17 00:00:00 2001 From: William Albertus Dembo Date: Thu, 24 Oct 2019 16:30:27 +0700 Subject: [PATCH] [Dembo|Hadrian.Siregar] Change order of message content for slack --- .../slack/message/execution.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/slack-notification-plugin/slack/message/execution.go b/plugins/slack-notification-plugin/slack/message/execution.go index ef4fbd8a..cd8f43fb 100644 --- a/plugins/slack-notification-plugin/slack/message/execution.go +++ b/plugins/slack-notification-plugin/slack/message/execution.go @@ -4,6 +4,7 @@ import ( "encoding/json" "errors" "proctor/pkg/notification/event" + "sort" ) type executionMessage struct { @@ -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 + "*"