Remove revoke block action
This commit is contained in:
parent
cc2a72bdd7
commit
258104dfdf
5 changed files with 3 additions and 34 deletions
|
@ -60,7 +60,7 @@ class Ability
|
|||
can [:index, :show, :resolve, :ignore, :reopen], Issue
|
||||
can :create, IssueComment
|
||||
can [:new, :create, :edit, :update, :destroy], Redaction
|
||||
can [:new, :create, :revoke, :revoke_all], UserBlock
|
||||
can [:new, :create, :revoke_all], UserBlock
|
||||
can :update, UserBlock, :creator => user
|
||||
can :update, UserBlock, :revoker => user
|
||||
can :update, UserBlock, :active? => true
|
||||
|
|
|
@ -10,10 +10,10 @@ class UserBlocksController < ApplicationController
|
|||
authorize_resource
|
||||
|
||||
before_action :lookup_user, :only => [:new, :create, :revoke_all, :blocks_on, :blocks_by]
|
||||
before_action :lookup_user_block, :only => [:show, :edit, :update, :revoke]
|
||||
before_action :lookup_user_block, :only => [:show, :edit, :update]
|
||||
before_action :require_valid_params, :only => [:create, :update]
|
||||
before_action :check_database_readable
|
||||
before_action :check_database_writable, :only => [:create, :update, :revoke, :revoke_all]
|
||||
before_action :check_database_writable, :only => [:create, :update, :revoke_all]
|
||||
|
||||
def index
|
||||
@params = params.permit
|
||||
|
@ -105,15 +105,6 @@ class UserBlocksController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
##
|
||||
# revokes the block, setting the end_time to now
|
||||
def revoke
|
||||
if request.post? && params[:confirm] && @user_block.revoke!(current_user)
|
||||
flash[:notice] = t ".flash"
|
||||
redirect_to(@user_block)
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
# revokes all active blocks
|
||||
def revoke_all
|
||||
|
|
|
@ -2958,8 +2958,6 @@ en:
|
|||
title: "User blocks"
|
||||
heading: "List of user blocks"
|
||||
empty: "No blocks have been made yet."
|
||||
revoke:
|
||||
flash: "This block has been revoked."
|
||||
revoke_all:
|
||||
title: "Revoking all blocks on %{block_on}"
|
||||
heading_html: "Revoking all blocks on %{block_on}"
|
||||
|
|
|
@ -334,7 +334,6 @@ OpenStreetMap::Application.routes.draw do
|
|||
get "/user/:display_name/blocks_by" => "user_blocks#blocks_by", :as => "user_blocks_by"
|
||||
get "/blocks/new/:display_name" => "user_blocks#new", :as => "new_user_block"
|
||||
resources :user_blocks, :except => :new
|
||||
post "/blocks/:id/revoke" => "user_blocks#revoke", :as => "revoke_user_block"
|
||||
match "/user/:display_name/blocks/revoke_all" => "user_blocks#revoke_all", :via => [:get, :post], :as => "revoke_all_user_blocks"
|
||||
|
||||
# issues and reports
|
||||
|
|
|
@ -33,10 +33,6 @@ class UserBlocksControllerTest < ActionDispatch::IntegrationTest
|
|||
{ :path => "/user_blocks/1", :method => :delete },
|
||||
{ :controller => "user_blocks", :action => "destroy", :id => "1" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/blocks/1/revoke", :method => :post },
|
||||
{ :controller => "user_blocks", :action => "revoke", :id => "1" }
|
||||
)
|
||||
|
||||
assert_routing(
|
||||
{ :path => "/user/username/blocks", :method => :get },
|
||||
|
@ -549,21 +545,6 @@ class UserBlocksControllerTest < ActionDispatch::IntegrationTest
|
|||
assert_equal other_moderator_user, block.revoker
|
||||
end
|
||||
|
||||
##
|
||||
# test the revoke action
|
||||
def test_revoke
|
||||
active_block = create(:user_block)
|
||||
|
||||
# Login as a moderator
|
||||
session_for(create(:moderator_user))
|
||||
|
||||
# Check that revoking a block works using POST
|
||||
post revoke_user_block_path(:id => active_block, :confirm => true)
|
||||
assert_redirected_to user_block_path(active_block)
|
||||
b = UserBlock.find(active_block.id)
|
||||
assert_in_delta Time.now.utc, b.ends_at, 1
|
||||
end
|
||||
|
||||
##
|
||||
# test the revoke all page
|
||||
def test_revoke_all_page
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue