diff --git a/lib/redmine_slack/listener.rb b/lib/redmine_slack/listener.rb index 13b3b7e..240a9a6 100644 --- a/lib/redmine_slack/listener.rb +++ b/lib/redmine_slack/listener.rb @@ -215,12 +215,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" @@ -228,10 +232,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"