X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/3443533ce3836673b0533c8474717a41e7f107fe..47027300607a0eb0127aa408fff508e56ad64021:/app/controllers/user_blocks_controller.rb diff --git a/app/controllers/user_blocks_controller.rb b/app/controllers/user_blocks_controller.rb index a671f0d16..07d0bc43c 100644 --- a/app/controllers/user_blocks_controller.rb +++ b/app/controllers/user_blocks_controller.rb @@ -12,7 +12,7 @@ class UserBlocksController < ApplicationController before_action :lookup_user_block, :only => [:show, :edit, :update, :revoke] before_action :require_valid_params, :only => [:create, :update] before_action :check_database_readable - before_action :check_database_writable, :only => [:create, :update, :revoke] + before_action :check_database_writable, :only => [:create, :update, :revoke, :revoke_all] def index @params = params.permit @@ -92,7 +92,11 @@ class UserBlocksController < ApplicationController ## # revokes all active blocks def revoke_all - # TODO revoke + if request.post? && params[:confirm] + @user.blocks.active.each { |block| block.revoke!(current_user) } + flash[:notice] = t ".flash" + redirect_to user_blocks_on_path(@user) + end end ##