Project

General

Profile

Actions

Defect #33829

open

Fix Atom feed for issues to correctly use the updated time for "updated" element instead of the created time

Added by Tatsuya Saito over 4 years ago. Updated 10 months ago.

Status:
Reopened
Priority:
Normal
Assignee:
Category:
Feeds
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

There are updated tags in the Atom of issues list.
However, the created on is exported.

I have attached a patch to fix this.


Files

patch.diff (759 Bytes) patch.diff Tatsuya Saito, 2020-08-08 09:34
patch_trunk_r19958_pt1.diff (2.64 KB) patch_trunk_r19958_pt1.diff note-3 patch pattern 1 Tatsuya Saito, 2020-08-08 17:26
patch_trunk_r19958_pt2.diff (924 Bytes) patch_trunk_r19958_pt2.diff note-3 patch pattern 2 Tatsuya Saito, 2020-08-08 17:26
33829-v3.patch (1.59 KB) 33829-v3.patch Go MAEDA, 2024-02-03 08:29
Actions #1

Updated by Tatsuya Saito over 4 years ago

This issue is reported in following Japanese forum.
https://groups.google.com/forum/#!topic/redmine-users-ja/wb78I8uVJEY

Actions #2

Updated by Tatsuya Saito over 4 years ago

I'm sorry, patch.diff breaks Redmine rake test.
It breaks activity view items.
Please reject the patch.

Actions #3

Updated by Tatsuya Saito over 4 years ago

I think this problem only affects the atom of issues list.
There are updated tags created by issue.event_datetime.
But issue.event_datetime is created_on.
I think you need to use updated_on for the atom of issue list.

I re-create the patches for this issue.
In the first pattern, issue_controller overwrites issue.event_datetime between atom exports.
The second pattern, application_controller.rb and common/feed.atom.builder, adds the code for the problem list atom.

Both work, but I don't think it's clean code.
I'll attach both patches in the hope that it will help you think about better code.

Actions #4

Updated by Go MAEDA over 4 years ago

  • Category changed from Issues list to Feeds
Actions #5

Updated by Go MAEDA almost 4 years ago

  • Target version set to Candidate for next major release
Actions #6

Updated by Go MAEDA 11 months ago

We can fix this issue by simply adding one line.

diff --git a/app/models/issue.rb b/app/models/issue.rb
index 670921eb0..408ab485b 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -48,6 +48,7 @@ class Issue < ApplicationRecord
                      :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}"},
+                :datetime => Proc.new {|o| o.updated_on},
                 :url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o.id}},
                 :type => Proc.new {|o| 'issue' + (o.closed? ? '-closed' : '')}
Actions #7

Updated by Go MAEDA 11 months ago

  • Subject changed from Tags "updated" in issues atom are "created on" to Atom feed for issues incorrectly uses created time instead of updated time for "updated" elements
  • Target version changed from Candidate for next major release to 6.0.0

Setting the target version to 6.0.0.

Actions #8

Updated by Go MAEDA 10 months ago

  • Subject changed from Atom feed for issues incorrectly uses created time instead of updated time for "updated" elements to Fix Atom feed for issues to correctly use the updated time for "updated" element instead of the created time
  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the fix in r22764.

Actions #9

Updated by Marius BĂLTEANU 10 months ago

3 tests fail after this change:



Failure:
ActivitiesControllerTest#test_previous_project_index [test/functional/activities_controller_test.rb:91]:
Expected: /1/
  Actual: "Project".
Expected 0 to be >= 1.

bin/rails test test/functional/activities_controller_test.rb:80

.F

Failure:
ActivitiesControllerTest#test_global_index [test/functional/activities_controller_test.rb:103]:
Expected: /28/
  Actual: "Project".
Expected 0 to be >= 1.

bin/rails test test/functional/activities_controller_test.rb:95

..F

Failure:
ActivitiesControllerTest#test_user_index [test/functional/activities_controller_test.rb:123]:
Expected: /1/
  Actual: "Project".
Expected 0 to be >= 1.

bin/rails test test/functional/activities_controller_test.rb:107

You can see the status here https://www.redmine.org/builds/logs/build_trunk_mysql_ruby-3.2_1017.html

On my local environment, reverting this change fixes all tests.

Actions #10

Updated by Marius BĂLTEANU 10 months ago

  • Status changed from Closed to Reopened
Actions #11

Updated by Go MAEDA 10 months ago

  • Target version changed from 6.0.0 to Candidate for next major release

Marius BĂLTEANU wrote in #note-9:

3 tests fail after this change:

[...]

You can see the status here https://www.redmine.org/builds/logs/build_trunk_mysql_ruby-3.2_1017.html

On my local environment, reverting this change fixes all tests.

Thank you, I have reverted the change in r22770.

Actions

Also available in: Atom PDF