From 1768d2c844063432aa901975b80d6ccf12df4add Mon Sep 17 00:00:00 2001 From: Alex Polozov Date: Mon, 11 Jan 2016 16:24:43 -0800 Subject: Parse Slack links in the attachment pretext --- api/post.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/api/post.go b/api/post.go index 958479427..fd0e37f29 100644 --- a/api/post.go +++ b/api/post.go @@ -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) } -- cgit v1.2.3-1-g7c22