Project

General

Profile

Actions

Defect #17852

closed

Issue journals should be ordered by created_on, not id

Added by name zero over 10 years ago. Updated about 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Issues
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Duplicate
Affected version:

Description

After migration to Redmine form another system, I noticed issue journals were not in the right order.
Our migration added file attachment journals last, so the ID was higher than the rest of the journals.

While this was incidental to the way we migrated and would probably nor occur in most Redmine installations, this issue could also occur under certain circumstances if, for example, Redmine was backed by a multimaster replicated database.

The correct(er) way to get the journals would be to sort them by the created_on column

--------------------------------
--- issues_controller.rb.ori Sun Jul 6 14:44:08 2014
+++ issues_controller.rb Fri Sep 12 08:05:33 2014
@ -104,7 +104,7 @ class IssuesController < ApplicationController
end

def show
- @journals = @issue.journals.includes(:user, :details).reorder("#{Journal.table_name}.id ASC").all
+ @journals = @issue.journals.includes(:user, :details).reorder("#{Journal.table_name}.created_on ASC").all
@journals.each_with_index {|j,i| j.indice = i+1}
@journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @issue.project)
Journal.preload_journals_details_custom_fields(@journals)

Please find the diff attached, as well as the migration diff to add the index.


Files

issues_controller.rb.diff (644 Bytes) issues_controller.rb.diff name zero, 2014-09-12 08:34
007_create_journals.rb.diff (605 Bytes) 007_create_journals.rb.diff name zero, 2014-09-12 08:34

Related issues

Is duplicate of Redmine - Defect #14881: Issue journals should be ordered by created_on, not idClosedJean-Philippe Lang

Actions
Actions #1

Updated by Go MAEDA about 10 years ago

  • Is duplicate of Defect #14881: Issue journals should be ordered by created_on, not id added
Actions #2

Updated by Go MAEDA about 10 years ago

  • Status changed from New to Closed
  • Resolution set to Duplicate

This issue duplicates with #14881.

Actions

Also available in: Atom PDF