Parse Slack links in the attachment pretext

This commit is contained in:
Alex Polozov
2016-01-11 16:24:43 -08:00
parent cf0d275ae4
commit 1768d2c844

View File

@@ -185,6 +185,12 @@ func CreateWebhookPost(c *Context, channelId, text, overrideUsername, overrideIc
attachment["text"] = aText
list[i] = attachment
}
if _, ok := attachment["pretext"]; ok {
aText := attachment["pretext"].(string)
aText = linkWithTextRegex.ReplaceAllString(aText, "[${2}](${1})")
attachment["pretext"] = aText
list[i] = attachment
}
}
post.AddProp(key, list)
}