ignore forbidden tags on missed search counter

This commit is contained in:
r888888888
2016-02-03 16:53:30 -08:00
parent 25bc2965b3
commit 16e437b048
3 changed files with 7 additions and 9 deletions

View File

@@ -2,7 +2,7 @@ module PostsHelper
def missed_post_search_count_js
return nil unless Danbooru.config.enable_post_search_counts
if params[:ms] == "1" && params[:tags].to_s.scan(/\S+/).size == 1
if params[:ms] == "1" && @post_set.post_count == 0 && @post_set.is_single_tag?
session_id = session.id
digest = OpenSSL::Digest.new("sha256")
sig = OpenSSL::HMAC.hexdigest(digest, Danbooru.config.shared_remote_key, ",#{session_id}")

View File

@@ -1,12 +1,10 @@
<script type="text/javascript">
$(function() {
var tags = $("#tags").val();
if ($(".post-preview").size() === 0) {
$.post("<%= Danbooru.config.report_server %>/missed_searches", {
session_id: "<%= session_id %>",
tags: tags,
sig: "<%= sig %>"
});
}
$.post("<%= Danbooru.config.report_server %>/missed_searches", {
session_id: "<%= session_id %>",
tags: tags,
sig: "<%= sig %>"
});
});
</script>

View File

@@ -233,7 +233,7 @@ module Danbooru
end
def can_user_see_post?(user, post)
if is_user_restricted?(user) && is_post_restricted?(post)
if is_user_restricted?(user) && is_post_restricted?(post)
false
else
true