From 09f159a9c056919a11b242cc310f52f1c4b058a5 Mon Sep 17 00:00:00 2001 From: shimizukawa Date: Fri, 18 Jul 2014 14:04:29 +0900 Subject: [PATCH 1/2] Omit changing long title/description text When we change a long description of issue, slack receive long notification and chat messages are flowed and gone. --- lib/redmine_slack/listener.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/redmine_slack/listener.rb b/lib/redmine_slack/listener.rb index e00695d..96ffcc2 100644 --- a/lib/redmine_slack/listener.rb +++ b/lib/redmine_slack/listener.rb @@ -147,7 +147,13 @@ def detail_to_field(detail) value = "<#{object_url issue}|#{escape issue}>" if issue end - value = "-" if value.empty? + value = if value.empty? + "-" + elsif value.count("\n") >= 5 + value.split("\n")[0,5].join("\n") + '...' + elsif value.length > 100 + value[0,97] + '...' + end result = { :title => title, :value => value } result[:short] = true if short From 92bd5576dc851320891851e08b16c5a0184eab14 Mon Sep 17 00:00:00 2001 From: Takayuki SHIMIZUKAWA Date: Tue, 22 Jul 2014 16:18:21 +0900 Subject: [PATCH 2/2] fix: Field vals had never been displayed on Slack --- lib/redmine_slack/listener.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/redmine_slack/listener.rb b/lib/redmine_slack/listener.rb index 96ffcc2..05cb722 100644 --- a/lib/redmine_slack/listener.rb +++ b/lib/redmine_slack/listener.rb @@ -153,6 +153,8 @@ def detail_to_field(detail) value.split("\n")[0,5].join("\n") + '...' elsif value.length > 100 value[0,97] + '...' + else + value end result = { :title => title, :value => value }