From 62235e215e7e902c60dd1263fd814a1aac686dd1 Mon Sep 17 00:00:00 2001 From: r888888888 Date: Sat, 23 Jun 2018 11:15:14 -0700 Subject: [PATCH] iqdb fixes --- app/logical/iqdb_proxy.rb | 2 +- test/functional/iqdb_queries_controller_test.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/logical/iqdb_proxy.rb b/app/logical/iqdb_proxy.rb index 09660bd3b..0d8080134 100644 --- a/app/logical/iqdb_proxy.rb +++ b/app/logical/iqdb_proxy.rb @@ -12,7 +12,7 @@ class IqdbProxy def self.decorate_posts(json) json.map do |x| begin - x["post"] = Post.find(x["id"]) + x["post"] = Post.find(x["post_id"]) x rescue ActiveRecord::RecordNotFound nil diff --git a/test/functional/iqdb_queries_controller_test.rb b/test/functional/iqdb_queries_controller_test.rb index 596db5019..04a547f16 100644 --- a/test/functional/iqdb_queries_controller_test.rb +++ b/test/functional/iqdb_queries_controller_test.rb @@ -17,7 +17,7 @@ class IqdbQueriesControllerTest < ActionDispatch::IntegrationTest @params = { url: @url } @mocked_response = [{ "post" => @posts[0], - "id" => @posts[0].id, + "post_id" => @posts[0].id, "score" => 1 }] end @@ -35,7 +35,7 @@ class IqdbQueriesControllerTest < ActionDispatch::IntegrationTest @url = @posts[0].preview_file_url @mocked_response = [{ "post" => @posts[0], - "id" => @posts[0].id, + "post_id" => @posts[0].id, "score" => 1 }] end @@ -49,7 +49,7 @@ class IqdbQueriesControllerTest < ActionDispatch::IntegrationTest context "with matches" do setup do - json = @posts.map {|x| {"id" => x.id, "score" => 1}}.to_json + json = @posts.map {|x| {"post_id" => x.id, "score" => 1}}.to_json @params = { matches: json } end