docbrown/app/controllers/admin/mods_controller.rb
Josh Puetz 1c566e0ec4
[deploy] Move /internal to `/admin (#9639)
* First draft - all the big changes

* Changing some more references to 'internal'

* Relocate internal request tests to admin

* Relocate internal system tests to admin

* Fix trailing space

* Test fix

* Move queries from internal to admin

* Docs updates

* Rename internal stimuls controllers to admin (plus docs)

* Rename admin layout

* Fix routing after rebase

* Fixes for latest added admin interfaces

* Serviceworker ignore paths
2020-08-07 10:36:26 -04:00

35 lines
758 B
Ruby

module Admin
class ModsController < Admin::ApplicationController
layout "admin"
INDEX_ATTRIBUTES = %i[
id
username
comments_count
badge_achievements_count
last_comment_at
].freeze
def index
@mods = Admin::ModeratorsQuery.call(
relation: User.select(INDEX_ATTRIBUTES),
options: permitted_params,
).page(params[:page]).per(50)
end
def update
@user = User.find(params[:id])
AssignTagModerator.add_trusted_role(@user)
redirect_to admin_mods_path(state: :potential),
flash: { success: "#{@user.username} now has Trusted role!" }
end
private
def permitted_params
params.permit(:state, :search, :page)
end
end
end