forked from e621ng/e621ng
Allow admins to edit users blacklists
This commit is contained in:
parent
81153b63c4
commit
655dd88671
@ -11,5 +11,16 @@ module Admin
|
||||
@user.promote_to!(params[:user][:level], params[:user])
|
||||
redirect_to edit_admin_user_path(@user), :notice => "User updated"
|
||||
end
|
||||
|
||||
def edit_blacklist
|
||||
@user = User.find(params[:id])
|
||||
end
|
||||
|
||||
def update_blacklist
|
||||
@user = User.find(params[:id])
|
||||
@user.update_attributes!(params[:user].permit([:blacklisted_tags]))
|
||||
ModAction.log(:user_blacklist_changed, {user_id: @user.id})
|
||||
redirect_to edit_blacklist_admin_user_path(@user)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
9
app/views/admin/users/edit_blacklist.html.erb
Normal file
9
app/views/admin/users/edit_blacklist.html.erb
Normal file
@ -0,0 +1,9 @@
|
||||
<div>
|
||||
<h4>View User Blacklist</h4>
|
||||
<div class='section' style='width:400px;'>
|
||||
<%= form_tag({action: "update_blacklist"}, method: :post) do %>
|
||||
<%= text_area "user", "blacklisted_tags", size: "60x20" %>
|
||||
<%= submit_tag "Save", name: nil %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
@ -20,6 +20,7 @@
|
||||
<% end %>
|
||||
|
||||
<% if CurrentUser.user.is_moderator? %>
|
||||
<%= subnav_link_to "Edit Blacklist", edit_blacklist_admin_user_path(@user) %>
|
||||
<%= subnav_link_to "Promote", edit_admin_user_path(@user) %>
|
||||
<% if @user.is_banned? %>
|
||||
<%= subnav_link_to "Unban", ban_path(@user.recent_ban) %>
|
||||
|
@ -6,7 +6,12 @@ Rails.application.routes.draw do
|
||||
mount Sidekiq::Web => '/sidekiq'
|
||||
|
||||
namespace :admin do
|
||||
resources :users, :only => [:edit, :update]
|
||||
resources :users, :only => [:edit, :update, :edit_blacklist, :update_blacklist] do
|
||||
member do
|
||||
get :edit_blacklist
|
||||
post :update_blacklist
|
||||
end
|
||||
end
|
||||
resource :alias_and_implication_import, :only => [:new, :create]
|
||||
resource :dashboard, :only => [:show]
|
||||
resources :exceptions, only: [:index, :show]
|
||||
|
Loading…
Reference in New Issue
Block a user