Fix parsing attachment field links into markdown (#2958) (#2959)

Field contents are stored in 'value' not 'text'.
Этот коммит содержится в:
thoemy
2016-05-12 14:30:44 +02:00
коммит произвёл Christopher Speller
родитель 4b260b761a
Коммит 3f0325fd22
2 изменённых файлов: 9 добавлений и 4 удалений

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

@@ -200,10 +200,10 @@ func CreateWebhookPost(c *Context, channelId, text, overrideUsername, overrideIc
// parse attachment field links into Markdown format // parse attachment field links into Markdown format
for j, fInt := range fields { for j, fInt := range fields {
field := fInt.(map[string]interface{}) field := fInt.(map[string]interface{})
if _, ok := field["text"]; ok { if _, ok := field["value"]; ok {
fText := field["text"].(string) fValue := field["value"].(string)
fText = linkWithTextRegex.ReplaceAllString(fText, "[${2}](${1})") fValue = linkWithTextRegex.ReplaceAllString(fValue, "[${2}](${1})")
field["text"] = fText field["value"] = fValue
fields[j] = field fields[j] = field
} }
} }

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

@@ -39,6 +39,11 @@
"short": true, "short": true,
"title": "Short 2", "title": "Short 2",
"value": "Another one" "value": "Another one"
},
{
"short": true,
"title": "Field with link",
"value": "<http://example.com|Link>"
} }
], ],
"mrkdwn_in": [ "mrkdwn_in": [