From 2853b3a47bbeb54543baf0e7e4b00cdb6b3c2a74 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 8 Aug 2017 07:41:33 -0500 Subject: 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 --- app/plugin/jira/webhook.go | 4 ++++ 1 file changed, 4 insertions(+) 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 { -- cgit v1.2.3-1-g7c22