FIX: Add email to admin user list when show_emails is enabled (#16636)

Fixes a regression on be519d2 where this case wasn't accounted for.

Reported at https://meta.discourse.org/t/-/226094
This commit is contained in:
Rafael dos Santos Silva 2022-05-04 14:07:22 -03:00 committed by GitHub
parent 2381f18eba
commit 63f239d0b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -69,6 +69,8 @@ class AdminUserIndexQuery
query = query.includes(:user_stat)
end
query = query.joins(:primary_email) if params[:show_emails] == "true"
query
end

View File

@ -39,6 +39,11 @@ RSpec.describe Admin::UsersController do
end.to change { UserHistory.where(action: UserHistory.actions[:check_email], acting_user_id: admin.id).count }.by(1)
expect(response.status).to eq(200)
end
it "can be ordered by emails" do
get "/admin/users/list.json", params: { show_emails: "true", order: "email" }
expect(response.status).to eq(200)
end
end
end