MM-13826 Webhooks: Allow "true"/"false" for bool values in payload body (#10114)

* Webhooks: Allow "true"/"false" for bool values in payload body

Some slack integrations encode bool fields as "true"/"false", which
was previously unsupported in mattermost due to how encoding/json works.
This commit adds an aliased type for bool that implements json.Unmarshaler
to maintain compatibility with Slack.

* Add missing copyright header to added files
Этот коммит содержится в:
Nathan Lowe
2019-01-24 10:36:10 -05:00
коммит произвёл Harrison Healey
родитель 684e4cb007
Коммит e961b4cd0d
3 изменённых файлов: 90 добавлений и 3 удалений

Просмотреть файл

@@ -31,9 +31,9 @@ type SlackAttachment struct {
}
type SlackAttachmentField struct {
Title string `json:"title"`
Value interface{} `json:"value"`
Short bool `json:"short"`
Title string `json:"title"`
Value interface{} `json:"value"`
Short SlackCompatibleBool `json:"short"`
}
func StringifySlackFieldValue(a []*SlackAttachment) []*SlackAttachment {