From: Go MAEDA Date: Thu, 12 Jan 2023 04:04:22 +0000 (+0000) Subject: Unreachable branch in ApplicationHelper#format_object due to the use of the deprecate... X-Git-Tag: 5.1.0~288 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5113040a05cefafd0f80ee380e6b3c36809f97c6;p=redmine.git Unreachable branch in ApplicationHelper#format_object due to the use of the deprecated Fixnum class (#38145). Patch by Go MAEDA. git-svn-id: https://svn.redmine.org/redmine/trunk@22041 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 316700270..fac31d569 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -255,31 +255,31 @@ module ApplicationHelper if block object = yield object end - case object.class.name - when 'Array' + case object + when Array formatted_objects = object.map {|o| format_object(o, html)} html ? safe_join(formatted_objects, ', ') : formatted_objects.join(', ') - when 'Time' + when Time format_time(object) - when 'Date' + when Date format_date(object) - when 'Fixnum' + when Integer object.to_s - when 'Float' + when Float sprintf "%.2f", object - when 'User', 'Group' + when User, Group html ? link_to_principal(object) : object.to_s - when 'Project' + when Project html ? link_to_project(object) : object.to_s - when 'Version' + when Version html ? link_to_version(object) : object.to_s - when 'TrueClass' + when TrueClass l(:general_text_Yes) - when 'FalseClass' + when FalseClass l(:general_text_No) - when 'Issue' + when Issue object.visible? && html ? link_to_issue(object) : "##{object.id}" - when 'Attachment' + when Attachment if html content_tag( :span, @@ -294,7 +294,7 @@ module ApplicationHelper else object.filename end - when 'CustomValue', 'CustomFieldValue' + when CustomValue, CustomFieldValue return "" unless object.customized&.visible? if object.custom_field