Project

General

Profile

Feature #36320 » 0002-Fix-deprecation-warning.patch

Takashi Kato, 2022-04-10 15:35

View differences:

app/controllers/attachments_controller.rb
def upload
# Make sure that API users get used to set this content type
# as it won't trigger Rails' automatic parsing of the request body for parameters
unless request.content_type == 'application/octet-stream'
unless request.media_type == 'application/octet-stream'
head 406
return
end
app/helpers/application_helper.rb
when 'Array'
formatted_objects = object.map {|o| format_object(o, html)}
html ? safe_join(formatted_objects, ', ') : formatted_objects.join(', ')
when 'Time'
when 'Time', 'ActiveSupport::TimeWithZone'
format_time(object)
when 'Date'
format_date(object)
......
'span', nil,
:class => "name icon icon-#{principal.class.name.downcase}"
)
) + principal
) + principal.to_s
)
end
s.html_safe
app/models/query.rb
else
from = from - 1 # second
end
if self.class.default_timezone == :utc
if ActiveRecord.default_timezone == :utc
from = from.utc
end
s << ("#{table}.#{field} > '%s'" % [quoted_time(from, is_custom_filter)])
......
if to.is_a?(Date)
to = date_for_user_time_zone(to.year, to.month, to.day).end_of_day
end
if self.class.default_timezone == :utc
if ActiveRecord.default_timezone == :utc
to = to.utc
end
s << ("#{table}.#{field} <= '%s'" % [quoted_time(to, is_custom_filter)])
app/views/custom_fields/_visibility_by_project_selector.html.erb
<div id="custom_field_project_ids">
<% project_ids = @custom_field.project_ids.to_a %>
<%= render_project_nested_lists(Project.all) do |p|
content_tag('label', check_box_tag('custom_field[project_ids][]', p.id, project_ids.include?(p.id), :id => nil) + ' ' + p)
content_tag('label', check_box_tag('custom_field[project_ids][]', p.id, project_ids.include?(p.id), :id => nil) + ' ' + p.to_s)
end %>
<%= hidden_field_tag('custom_field[project_ids][]', '', :id => nil) %>
</div>
config/application.rb
# :all can be used as a placeholder for all plugins not explicitly named.
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
config.active_record.legacy_connection_handling = false
config.active_support.remove_deprecated_time_with_zone_name = true
config.active_record.store_full_sti_class = true
config.active_record.default_timezone = :local
test/unit/query_test.rb
User.current.pref.update_attribute :time_zone, 'Hawaii'
# assume timestamps are stored as utc
ActiveRecord::Base.default_timezone = :utc
ActiveRecord.default_timezone = :utc
from = Date.parse '2016-03-20'
to = Date.parse '2016-03-22'
......
t = Time.new(2016, 3, 23, 9, 59, 59, 0).end_of_hour
assert_equal "table.field > '#{Query.connection.quoted_date f}' AND table.field <= '#{Query.connection.quoted_date t}'", c
ensure
ActiveRecord::Base.default_timezone = :local # restore Redmine default
ActiveRecord.default_timezone = :local # restore Redmine default
end
def test_project_statement_with_closed_subprojects
(2-2/13)