[IQDB] Remove xhr handling

This commit is contained in:
Earlopain 2023-05-07 14:03:57 +02:00
parent 70dba28cfa
commit b58865149f
No known key found for this signature in database
GPG Key ID: 6CFB948E15246897
3 changed files with 2 additions and 13 deletions

View File

@ -1,6 +1,6 @@
class IqdbQueriesController < ApplicationController
respond_to :html, :json
before_action :detect_xhr, :throttle
before_action :throttle
def show
if params[:file]
@ -18,10 +18,6 @@ class IqdbQueriesController < ApplicationController
end
respond_with(@matches) do |fmt|
fmt.html do |html|
html.xhr { render layout: false }
end
fmt.json do
render json: @matches, root: "posts"
end
@ -45,10 +41,4 @@ class IqdbQueriesController < ApplicationController
end
end
end
def detect_xhr
if request.xhr?
request.variant = :xhr
end
end
end

View File

@ -1 +0,0 @@
<%= render "iqdb_queries/matches" %>

View File

@ -25,7 +25,7 @@ class IqdbQueriesControllerTest < ActionDispatch::IntegrationTest
should "render a response" do
IqdbProxy.expects(:query_url).with(@url, nil).returns(@mocked_response)
get_auth iqdb_queries_path(variant: "xhr"), @user, params: @params
get_auth iqdb_queries_path, @user, params: @params
assert_select("#post_#{@posts[0].id}")
end
end