fix for iqdb queries

This commit is contained in:
Albert Yi
2016-12-02 13:06:34 -08:00
parent a358247c1c
commit 8e5331d234
3 changed files with 4 additions and 4 deletions

View File

@@ -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

View File

@@ -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}"

View File

@@ -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>';