diff options
author | Chris <ccbrown112@gmail.com> | 2017-08-08 07:41:33 -0500 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2017-08-08 08:41:33 -0400 |
commit | 2853b3a47bbeb54543baf0e7e4b00cdb6b3c2a74 (patch) | |
tree | 552d8df9df2fecde5f4e6ec516e046cd612eab59 /app/plugin/jira/webhook.go | |
parent | 2c8fe15cc8729f9ea0adbc336590bf278ab0d2f5 (diff) | |
download | chat-2853b3a47bbeb54543baf0e7e4b00cdb6b3c2a74.tar.gz chat-2853b3a47bbeb54543baf0e7e4b00cdb6b3c2a74.tar.bz2 chat-2853b3a47bbeb54543baf0e7e4b00cdb6b3c2a74.zip |
PLT-7263: truncate long issue descriptions (#7142)
* truncate long issue descriptions, add tests
* minor tweak to text template
* add license header
* remove tests for now (since dependency is blocked)
* remove second jira link
Diffstat (limited to 'app/plugin/jira/webhook.go')
-rw-r--r-- | app/plugin/jira/webhook.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/plugin/jira/webhook.go b/app/plugin/jira/webhook.go index c09e46703..fee33767b 100644 --- a/app/plugin/jira/webhook.go +++ b/app/plugin/jira/webhook.go @@ -92,7 +92,11 @@ func (w *Webhook) SlackAttachment() (*model.SlackAttachment, error) { text, err := w.renderText("" + "[{{.Issue.Fields.Summary}}]({{.JIRAURL}}/browse/{{.Issue.Key}})" + "{{if eq .WebhookEvent \"jira:issue_created\"}}{{if ne .Issue.Fields.Description \"\"}}" + + "{{if len .Issue.Fields.Description | lt 3000}}" + + "\n\n{{printf \"%.3000s\" .Issue.Fields.Description}}..." + + "{{else}}" + "\n\n{{.Issue.Fields.Description}}" + + "{{end}}" + "{{end}}{{end}}" + "") if err != nil { |