From 992da1fef3e0fd1bad0038c01d658c9dc114d2b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 22 Dec 2021 16:02:49 +0100 Subject: [PATCH] Make sure hidden users are shown in order The test "Action links remember the pagination setting and the filter" was failing sometimes because it assumed the third user created was going to appear in the third place, but that wasn't always the case. So we're using the same order we use in the rest of the sections dealing with hidden content. --- app/controllers/admin/hidden_users_controller.rb | 2 +- spec/system/admin/hidden_users_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin/hidden_users_controller.rb b/app/controllers/admin/hidden_users_controller.rb index 1b5635270..86801fcda 100644 --- a/app/controllers/admin/hidden_users_controller.rb +++ b/app/controllers/admin/hidden_users_controller.rb @@ -4,7 +4,7 @@ class Admin::HiddenUsersController < Admin::BaseController before_action :load_user, only: [:confirm_hide, :restore] def index - @users = User.only_hidden.send(@current_filter).page(params[:page]) + @users = User.only_hidden.send(@current_filter).order(hidden_at: :desc).page(params[:page]) end def show diff --git a/spec/system/admin/hidden_users_spec.rb b/spec/system/admin/hidden_users_spec.rb index 59b19602e..0cf4744d4 100644 --- a/spec/system/admin/hidden_users_spec.rb +++ b/spec/system/admin/hidden_users_spec.rb @@ -83,7 +83,7 @@ describe "Admin hidden users", :admin do visit admin_hidden_users_path(filter: "with_confirmed_hide", page: 2) - accept_confirm("Are you sure? Restore \"#{users[2].name}\"") do + accept_confirm("Are you sure? Restore \"#{users[-3].name}\"") do click_button "Restore", match: :first, exact: true end