fix for iqdb queries
This commit is contained in:
@@ -30,6 +30,6 @@ protected
|
||||
@download = Iqdb::Download.new(@post.complete_preview_file_url)
|
||||
@download.find_similar
|
||||
@results = @download.matches
|
||||
render :layout => false, :action => "create_by_url"
|
||||
render :layout => false, :action => "create_by_post"
|
||||
end
|
||||
end
|
||||
@@ -33,9 +33,9 @@ module Iqdb
|
||||
if resp.is_a?(Net::HTTPSuccess)
|
||||
json = JSON.parse(resp.body)
|
||||
if json.is_a?(Array)
|
||||
json
|
||||
@matches = json
|
||||
else
|
||||
[]
|
||||
@matches = []
|
||||
end
|
||||
else
|
||||
raise "HTTP error code: #{resp.code} #{resp.message}"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
var html = '';
|
||||
<% if @results.any? %>
|
||||
<% @results.each do |match| %>
|
||||
html += '<%= j PostPresenter.preview(Post.find(match.post_id), :tags => "status:any") %>';
|
||||
html += '<%= j PostPresenter.preview(Post.find(match["post_id"]), :tags => "status:any") %>';
|
||||
<% end %>
|
||||
<% else %>
|
||||
html += '<p>No matches found</p>';
|
||||
|
||||
Reference in New Issue
Block a user