diff options
author | Alex Polozov <apskim@users.noreply.github.com> | 2016-01-11 16:24:43 -0800 |
---|---|---|
committer | Alex Polozov <apskim@users.noreply.github.com> | 2016-01-11 16:24:43 -0800 |
commit | 1768d2c844063432aa901975b80d6ccf12df4add (patch) | |
tree | ade2ba3f8e8705412df82392580e8acfdf2f1c5f /api/post.go | |
parent | cf0d275ae44ae0e554c039b34a9b68ddac7a081f (diff) | |
download | chat-1768d2c844063432aa901975b80d6ccf12df4add.tar.gz chat-1768d2c844063432aa901975b80d6ccf12df4add.tar.bz2 chat-1768d2c844063432aa901975b80d6ccf12df4add.zip |
Parse Slack links in the attachment pretext
Diffstat (limited to 'api/post.go')
-rw-r--r-- | api/post.go | 6 |
1 files changed, 6 insertions, 0 deletions
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) } |