Fix /admin/tags/:id crashing since Rails 6.1 update (#15953)

Raw SQL passed to `pluck` now has to be explicitly marked as SQL via
Arel.sql, see https://github.com/rails/rails/pull/27947
master
Claire 4 years ago committed by GitHub
parent 59f94593d0
commit a650a1157d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      app/controllers/admin/tags_controller.rb
  2. 12
      spec/controllers/admin/tags_controller_spec.rb

@ -59,8 +59,8 @@ module Admin
.where(Status.arel_table[:id].gteq(Mastodon::Snowflake.id_at(Time.now.utc.beginning_of_day))) .where(Status.arel_table[:id].gteq(Mastodon::Snowflake.id_at(Time.now.utc.beginning_of_day)))
.joins(:account) .joins(:account)
.group('accounts.domain') .group('accounts.domain')
.reorder('statuses_count desc') .reorder(statuses_count: :desc)
.pluck('accounts.domain, count(*) AS statuses_count') .pluck(Arel.sql('accounts.domain, count(*) AS statuses_count'))
end end
def set_counters def set_counters

@ -20,4 +20,16 @@ RSpec.describe Admin::TagsController, type: :controller do
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
end end
end end
describe 'GET #show' do
let!(:tag) { Fabricate(:tag) }
before do
get :show, params: { id: tag.id }
end
it 'returns status 200' do
expect(response).to have_http_status(200)
end
end
end end

Loading…
Cancel
Save