Index: app/controllers/messages_controller.rb =================================================================== --- app/controllers/messages_controller.rb (revision 15400) +++ app/controllers/messages_controller.rb (working copy) @@ -47,6 +47,7 @@ limit(@reply_pages.per_page). offset(@reply_pages.offset). to_a + @replies.reverse! if User.current.wants_comments_in_reverse_order? @reply = Message.new(:subject => "RE: #{@message.subject}") render :action => "show", :layout => false if request.xhr? Index: test/functional/messages_controller_test.rb =================================================================== --- test/functional/messages_controller_test.rb (revision 15400) +++ test/functional/messages_controller_test.rb (working copy) @@ -71,6 +71,17 @@ assert_select 'div#reply textarea#message_content' end + def test_show_comments_sorting_desc + user = User.find(2) + user.pref.comments_sorting = 'desc' + user.pref.save! + @request.session[:user_id] = user.id + get :show, :board_id => 1, :id => 1 + assert_response :success + replies = assigns(:replies) + assert replies.first.created_on > replies.last.created_on + end + def test_show_message_not_found get :show, :board_id => 1, :id => 99999 assert_response 404