Project

General

Profile

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

Takashi Kato, 2022-04-10 15:35

View differences:

app/controllers/attachments_controller.rb
100 100
  def upload
101 101
    # Make sure that API users get used to set this content type
102 102
    # as it won't trigger Rails' automatic parsing of the request body for parameters
103
    unless request.content_type == 'application/octet-stream'
103
    unless request.media_type == 'application/octet-stream'
104 104
      head 406
105 105
      return
106 106
    end
app/helpers/application_helper.rb
259 259
    when 'Array'
260 260
      formatted_objects = object.map {|o| format_object(o, html)}
261 261
      html ? safe_join(formatted_objects, ', ') : formatted_objects.join(', ')
262
    when 'Time'
262
    when 'Time', 'ActiveSupport::TimeWithZone'
263 263
      format_time(object)
264 264
    when 'Date'
265 265
      format_date(object)
......
631 631
                 'span', nil,
632 632
                 :class => "name icon icon-#{principal.class.name.downcase}"
633 633
               )
634
            ) + principal
634
            ) + principal.to_s
635 635
        )
636 636
    end
637 637
    s.html_safe
app/models/query.rb
1581 1581
      else
1582 1582
        from = from - 1 # second
1583 1583
      end
1584
      if self.class.default_timezone == :utc
1584
      if ActiveRecord.default_timezone == :utc
1585 1585
        from = from.utc
1586 1586
      end
1587 1587
      s << ("#{table}.#{field} > '%s'" % [quoted_time(from, is_custom_filter)])
......
1590 1590
      if to.is_a?(Date)
1591 1591
        to = date_for_user_time_zone(to.year, to.month, to.day).end_of_day
1592 1592
      end
1593
      if self.class.default_timezone == :utc
1593
      if ActiveRecord.default_timezone == :utc
1594 1594
        to = to.utc
1595 1595
      end
1596 1596
      s << ("#{table}.#{field} <= '%s'" % [quoted_time(to, is_custom_filter)])
app/views/custom_fields/_visibility_by_project_selector.html.erb
4 4
  <div id="custom_field_project_ids">
5 5
    <% project_ids = @custom_field.project_ids.to_a %>
6 6
    <%= render_project_nested_lists(Project.all) do |p|
7
      content_tag('label', check_box_tag('custom_field[project_ids][]', p.id, project_ids.include?(p.id), :id => nil) + ' ' + p)
7
      content_tag('label', check_box_tag('custom_field[project_ids][]', p.id, project_ids.include?(p.id), :id => nil) + ' ' + p.to_s)
8 8
    end %>
9 9
    <%= hidden_field_tag('custom_field[project_ids][]', '', :id => nil) %>
10 10
  </div>
config/application.rb
27 27
    # :all can be used as a placeholder for all plugins not explicitly named.
28 28
    # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
29 29

  
30
    config.active_record.legacy_connection_handling = false
31
    config.active_support.remove_deprecated_time_with_zone_name = true
32

  
30 33
    config.active_record.store_full_sti_class = true
31 34
    config.active_record.default_timezone = :local
32 35

  
test/unit/query_test.rb
2610 2610
    User.current.pref.update_attribute :time_zone, 'Hawaii'
2611 2611

  
2612 2612
    # assume timestamps are stored as utc
2613
    ActiveRecord::Base.default_timezone = :utc
2613
    ActiveRecord.default_timezone = :utc
2614 2614

  
2615 2615
    from = Date.parse '2016-03-20'
2616 2616
    to = Date.parse '2016-03-22'
......
2621 2621
    t = Time.new(2016, 3, 23, 9, 59, 59, 0).end_of_hour
2622 2622
    assert_equal "table.field > '#{Query.connection.quoted_date f}' AND table.field <= '#{Query.connection.quoted_date t}'", c
2623 2623
  ensure
2624
    ActiveRecord::Base.default_timezone = :local # restore Redmine default
2624
    ActiveRecord.default_timezone = :local # restore Redmine default
2625 2625
  end
2626 2626

  
2627 2627
  def test_project_statement_with_closed_subprojects
(2-2/13)