瀏覽代碼

Fix Atom feed for issues to correctly use the updated time for "updated" element instead of the created time (#33829).

Patch by Go MAEDA.


git-svn-id: https://svn.redmine.org/redmine/trunk@22764 e93f8b46-1217-0410-a6f0-8f06a7374b81
pull/149/head
Go MAEDA 2 月之前
父節點
當前提交
c94d7c5a57
共有 2 個文件被更改,包括 11 次插入0 次删除
  1. 1
    0
      app/models/issue.rb
  2. 10
    0
      test/functional/issues_controller_test.rb

+ 1
- 0
app/models/issue.rb 查看文件

:scope => lambda {|options| options[:open_issues] ? self.open : self.all} :scope => lambda {|options| options[:open_issues] ? self.open : self.all}


acts_as_event :title => Proc.new {|o| "#{o.tracker.name} ##{o.id} (#{o.status}): #{o.subject}"}, acts_as_event :title => Proc.new {|o| "#{o.tracker.name} ##{o.id} (#{o.status}): #{o.subject}"},
:datetime => Proc.new {|o| o.updated_on},
:url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o.id}}, :url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o.id}},
:type => Proc.new {|o| 'issue' + (o.closed? ? '-closed' : '')} :type => Proc.new {|o| 'issue' + (o.closed? ? '-closed' : '')}



+ 10
- 0
test/functional/issues_controller_test.rb 查看文件

assert_select 'link[rel=self][href=?]', 'http://test.host/projects/ecookbook/issues.atom' assert_select 'link[rel=self][href=?]', 'http://test.host/projects/ecookbook/issues.atom'
assert_select 'link[rel=alternate][href=?]', 'http://test.host/projects/ecookbook/issues' assert_select 'link[rel=alternate][href=?]', 'http://test.host/projects/ecookbook/issues'
assert_select 'entry link[href=?]', 'http://test.host/issues/1' assert_select 'entry link[href=?]', 'http://test.host/issues/1'

assert_select 'entry' do |entries|
entries.each do |entry|
issue_id = entry.at('id').text.split('/').last.to_i
issue = Issue.find(issue_id)
formatted_updated_on = issue.updated_on.utc.iso8601
# <updated> element should use the value of `Issue#updated_on`
assert_select entry, 'updated', text: formatted_updated_on
end
end
end end
end end



Loading…
取消
儲存