Actions
Defect #11170
closedTopics sort order is broken in Redmine 2.x
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
Fixed
Affected version:
Description
Because of Rails 3 by default uses order from has_many :order statement before any defined order, messages are always sorted by creation time first regardless of sticky attribute.
To fix it, line 46 in file app/controllers/boards_controller.rb
@topics = @board.topics.find :all, :order => ["#{Message.table_name}.sticky DESC", sort_clause].compact.join(', '),
:include => [:author, {:last_reply => :author}],
:limit => @topic_pages.items_per_page,
:offset => @topic_pages.current.offset
should be changed to
@topics = @board.topics.reorder(["#{Message.table_name}.sticky DESC", sort_clause].compact.join(', ')).all(
:include => [:author, {:last_reply => :author}],
:limit => @topic_pages.items_per_page,
:offset => @topic_pages.current.offset)
Actions