Project

General

Profile

Defect #33829 » patch_trunk_r19958_pt1.diff

note-3 patch pattern 1 - Tatsuya Saito, 2020-08-08 17:26

View differences:

app/controllers/application_controller.rb (working copy)
564 564
  end
565 565

  
566 566
  def render_feed(items, options={})
567
    @type = options[:type]
567 568
    @items = (items || []).to_a
568
    @items.sort! {|x,y| y.event_datetime <=> x.event_datetime }
569
    if @type == :issues
570
      @items.sort! {|x,y| y.updated_on <=> x.updated_on }
571
    else
572
      @items.sort! {|x,y| y.event_datetime <=> x.event_datetime }
573
    end
569 574
    @items = @items.slice(0, Setting.feeds_limit.to_i)
570 575
    @title = options[:title] || Setting.app_title
571 576
    render :template => "common/feed", :formats => [:atom], :layout => false,
app/controllers/issues_controller.rb (working copy)
63 63
        format.atom do
64 64
          @issues = @query.issues(:limit => Setting.feeds_limit.to_i)
65 65
          render_feed(@issues,
66
                      :title => "#{@project || Setting.app_title}: #{l(:label_issue_plural)}")
66
                      :title => "#{@project || Setting.app_title}: #{l(:label_issue_plural)}",
67
                      :type => :issues)
67 68
        end
68 69
        format.csv do
69 70
          @issues = @query.issues(:limit => Setting.issues_export_limit.to_i)
app/views/common/feed.atom.builder (working copy)
9 9
  xml.link    "rel" => "alternate", "href" => url_for(:params => request.query_parameters.merge(:format => nil, :key => nil), :only_path => false, :protocol => protocol, :host => host)
10 10
  xml.id      home_url
11 11
  xml.icon    favicon_url
12
  xml.updated((@items.first ? @items.first.event_datetime : Time.now).xmlschema)
12
  xml.updated((@items.first ? (@type == :issues ? @items.first.updated_on : @items.first.event_datetime) : Time.now).xmlschema)
13 13
  xml.author  { xml.name "#{Setting.app_title}" }
14 14
  xml.generator(:uri => Redmine::Info.url) { xml.text! Redmine::Info.app_name; }
15 15
  @items.each do |item|
......
22 22
      end
23 23
      xml.link "rel" => "alternate", "href" => url
24 24
      xml.id url
25
      xml.updated item.event_datetime.xmlschema
25
      xml.updated (@type == :issues ? item.updated_on : item.event_datetime).xmlschema
26 26
      author = item.event_author if item.respond_to?(:event_author)
27 27
      xml.author do
28 28
        xml.name(author)
(2-2/4)