summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-01-31 10:42:41 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-01-31 10:42:41 +0000
commite11f77a4b038ae19e7987d5e546710ce9b7d839e (patch)
tree64adeb260228903249b2bdda12e8baf3d92d6077 /app
parentdefd3f439f336a5c90532ce133b132a467ebbff5 (diff)
downloadredmine-e11f77a4b038ae19e7987d5e546710ce9b7d839e.tar.gz
redmine-e11f77a4b038ae19e7987d5e546710ce9b7d839e.zip
Show long text custom field changes as a diff (#15236).
git-svn-id: http://svn.redmine.org/redmine/trunk@13954 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/controllers/journals_controller.rb12
-rw-r--r--app/helpers/issues_helper.rb17
2 files changed, 23 insertions, 6 deletions
diff --git a/app/controllers/journals_controller.rb b/app/controllers/journals_controller.rb
index fd75d752a..bae6ca2bc 100644
--- a/app/controllers/journals_controller.rb
+++ b/app/controllers/journals_controller.rb
@@ -49,9 +49,17 @@ class JournalsController < ApplicationController
if params[:detail_id].present?
@detail = @journal.details.find_by_id(params[:detail_id])
else
- @detail = @journal.details.detect {|d| d.prop_key == 'description'}
+ @detail = @journal.details.detect {|d| d.property == 'attr' && d.prop_key == 'description'}
+ end
+ unless @issue && @detail
+ render_404
+ return false
+ end
+ if @detail.property == 'cf'
+ unless @detail.custom_field && @detail.custom_field.visible_by?(@issue.project, User.current)
+ raise ::Unauthorized
+ end
end
- (render_404; return false) unless @issue && @detail
@diff = Redmine::Helpers::Diff.new(@detail.value, @detail.old_value)
end
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index da9995345..f974914ac 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -294,6 +294,8 @@ module IssuesHelper
# Returns the textual representation of a single journal detail
def show_detail(detail, no_html=false, options={})
multiple = false
+ show_diff = false
+
case detail.property
when 'attr'
field = detail.prop_key.to_s.gsub(/\_id$/, "")
@@ -320,14 +322,21 @@ module IssuesHelper
when 'is_private'
value = l(detail.value == "0" ? :general_text_No : :general_text_Yes) unless detail.value.blank?
old_value = l(detail.old_value == "0" ? :general_text_No : :general_text_Yes) unless detail.old_value.blank?
+
+ when 'description'
+ show_diff = true
end
when 'cf'
custom_field = detail.custom_field
if custom_field
- multiple = custom_field.multiple?
label = custom_field.name
- value = format_value(detail.value, custom_field) if detail.value
- old_value = format_value(detail.old_value, custom_field) if detail.old_value
+ if custom_field.format.class.change_as_diff
+ show_diff = true
+ else
+ multiple = custom_field.multiple?
+ value = format_value(detail.value, custom_field) if detail.value
+ old_value = format_value(detail.old_value, custom_field) if detail.old_value
+ end
end
when 'attachment'
label = l(:label_attachment)
@@ -373,7 +382,7 @@ module IssuesHelper
end
end
- if detail.property == 'attr' && detail.prop_key == 'description'
+ if show_diff
s = l(:text_journal_changed_no_detail, :label => label)
unless no_html
diff_link = link_to 'diff',