pools: remove pool element destroy action.
This endpoint was for removing a single post from a pool. This wasn't used anywhere within Danbooru.
This commit is contained in:
@@ -12,11 +12,4 @@ class PoolElementsController < ApplicationController
|
||||
@error = "That pool does not exist"
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@pool = Pool.find(params[:pool_id])
|
||||
@post = Post.find(params[:post_id])
|
||||
@pool.remove!(@post)
|
||||
respond_with(@pool, :location => post_path(@post))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -182,7 +182,7 @@ Rails.application.routes.draw do
|
||||
end
|
||||
resource :order, :only => [:edit], :controller => "pool_orders"
|
||||
end
|
||||
resource :pool_element, :only => [:create, :destroy]
|
||||
resource :pool_element, :only => [:create]
|
||||
resources :pool_versions, :only => [:index] do
|
||||
member do
|
||||
get :diff
|
||||
|
||||
@@ -31,27 +31,5 @@ class PoolElementsControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_equal([@post.id], @pool.post_ids)
|
||||
end
|
||||
end
|
||||
|
||||
context "destroy action" do
|
||||
setup do
|
||||
as_user { @pool.add!(@post) }
|
||||
end
|
||||
|
||||
should "remove a post from a pool" do
|
||||
delete_auth pool_element_path, @user, params: {:pool_id => @pool.id, :post_id => @post.id, :format => "json"}
|
||||
@pool.reload
|
||||
assert_equal([], @pool.post_ids)
|
||||
end
|
||||
|
||||
should "do nothing if the post is not a member of the pool" do
|
||||
@pool.reload
|
||||
as_user do
|
||||
@pool.remove!(@post)
|
||||
end
|
||||
delete_auth pool_element_path, @user, params: {:pool_id => @pool.id, :post_id => @post.id, :format => "json"}
|
||||
@pool.reload
|
||||
assert_equal([], @pool.post_ids)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user