eliminate unused vars in search counters
This commit is contained in:
@@ -23,8 +23,8 @@ module PostsHelper
|
|||||||
if params[:ms] == "1" && @post_set.post_count == 0 && @post_set.is_single_tag?
|
if params[:ms] == "1" && @post_set.post_count == 0 && @post_set.is_single_tag?
|
||||||
session_id = session.id
|
session_id = session.id
|
||||||
verifier = ActiveSupport::MessageVerifier.new(Danbooru.config.reportbooru_key, serializer: JSON, digest: "SHA256")
|
verifier = ActiveSupport::MessageVerifier.new(Danbooru.config.reportbooru_key, serializer: JSON, digest: "SHA256")
|
||||||
sig = verifier.generate(",#{session_id}")
|
sig = verifier.generate("#{params[:tags]},#{session_id}")
|
||||||
return render("posts/partials/index/missed_search_count", session_id: session_id, sig: sig)
|
return render("posts/partials/index/missed_search_count", sig: sig)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ module PostsHelper
|
|||||||
value = session.id
|
value = session.id
|
||||||
verifier = ActiveSupport::MessageVerifier.new(Danbooru.config.reportbooru_key, serializer: JSON, digest: "SHA256")
|
verifier = ActiveSupport::MessageVerifier.new(Danbooru.config.reportbooru_key, serializer: JSON, digest: "SHA256")
|
||||||
sig = verifier.generate("#{key},#{value}")
|
sig = verifier.generate("#{key},#{value}")
|
||||||
return render("posts/partials/index/search_count", key: key, value: value, sig: sig)
|
return render("posts/partials/index/search_count", sig: sig)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ module PostsHelper
|
|||||||
|
|
||||||
key = "uid"
|
key = "uid"
|
||||||
value = user.id
|
value = user.id
|
||||||
verifier = ActiveSupport::MessageVerifier.new(Danbooru.config.reportbooru_key, serializer: JSON, digest: "SHA256")
|
verifier = ActiveSupporist::MessageVerifier.new(Danbooru.config.reportbooru_key, serializer: JSON, digest: "SHA256")
|
||||||
sig = verifier.generate("#{key},#{value}")
|
sig = verifier.generate("#{key},#{value}")
|
||||||
render("users/common_searches", user: user, sig: sig)
|
render("users/common_searches", user: user, sig: sig)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class PopularSearchService
|
|||||||
dates = date.strftime("%Y-%m-%d")
|
dates = date.strftime("%Y-%m-%d")
|
||||||
|
|
||||||
Cache.get("ps-day-#{dates}", 1.minute) do
|
Cache.get("ps-day-#{dates}", 1.minute) do
|
||||||
url = "#{Danbooru.config.reportbooru_server}/hits/day?date=#{dates}"
|
url = "#{Danbooru.config.reportbooru_server}/post_searches/day?date=#{dates}"
|
||||||
response = HTTParty.get(url, Danbooru.config.httparty_options.reverse_merge(timeout: 3))
|
response = HTTParty.get(url, Danbooru.config.httparty_options.reverse_merge(timeout: 3))
|
||||||
if response.success?
|
if response.success?
|
||||||
response = response.body
|
response = response.body
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
$(function() {
|
$(function() {
|
||||||
var tags = $("#tags").val();
|
var tags = $("#tags").val();
|
||||||
$.post("<%= Danbooru.config.reportbooru_server %>/missed_searches", {
|
$.post("<%= Danbooru.config.reportbooru_server %>/missed_searches", {
|
||||||
session_id: "<%= session_id %>",
|
|
||||||
tags: tags,
|
|
||||||
sig: "<%= sig %>"
|
sig: "<%= sig %>"
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,11 +1,6 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function() {
|
$(function() {
|
||||||
$.post("<%= Danbooru.config.reportbooru_server %>/hits", {
|
$.post("<%= Danbooru.config.reportbooru_server %>/post_searches", {
|
||||||
key: "<%= key %>",
|
|
||||||
value: "<%= value %>",
|
|
||||||
<% if CurrentUser.user.is_platinum? %>
|
|
||||||
uid: <%= CurrentUser.user.id %>,
|
|
||||||
<% end %>
|
|
||||||
sig: "<%= sig %>"
|
sig: "<%= sig %>"
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
module ReportbooruHelper
|
module ReportbooruHelper
|
||||||
def mock_popular_search_service!
|
def mock_popular_search_service!
|
||||||
Danbooru.config.stubs(:reportbooru_server).returns("http://localhost:3003")
|
Danbooru.config.stubs(:reportbooru_server).returns("http://localhost:3003")
|
||||||
stub_request(:get, "http://localhost:3003/hits/month?date=#{Date.today}").to_return(body: "kantai_collection 1000.0\ntouhou 500.0")
|
stub_request(:get, "http://localhost:3003/post_searches/month?date=#{Date.today}").to_return(body: "kantai_collection 1000.0\ntouhou 500.0")
|
||||||
stub_request(:get, "http://localhost:3003/hits/day?date=#{Date.today}").to_return(body: "kantai_collection 1000.0\ntouhou 500.0")
|
stub_request(:get, "http://localhost:3003/post_searches/day?date=#{Date.today}").to_return(body: "kantai_collection 1000.0\ntouhou 500.0")
|
||||||
end
|
end
|
||||||
|
|
||||||
def mock_missed_search_service!
|
def mock_missed_search_service!
|
||||||
|
|||||||
Reference in New Issue
Block a user