diff --git a/lib/redmine_slack/listener.rb b/lib/redmine_slack/listener.rb index 72df492..0dc2afd 100755 --- a/lib/redmine_slack/listener.rb +++ b/lib/redmine_slack/listener.rb @@ -252,12 +252,16 @@ def channel_for_project(proj) end def detail_to_field(detail) - if detail.property == "cf" - key = CustomField.find(detail.prop_key).name rescue nil + case detail.property + when "cf" + custom_field = detail.custom_field + key = custom_field.name title = key - elsif detail.property == "attachment" + value = (detail.value)? IssuesController.helpers.format_value(detail.value, custom_field) : "" + when "attachment" key = "attachment" title = I18n.t :label_attachment + value = escape detail.value.to_s else key = detail.prop_key.to_s.sub("_id", "") if key == "parent" @@ -265,10 +269,10 @@ def detail_to_field(detail) else title = I18n.t "field_#{key}" end + value = escape detail.value.to_s end short = true - value = escape detail.value.to_s case key when "title", "subject", "description"