@@ -727,7 +727,7 @@ class Post < ActiveRecord::Base
|
||||
def get_count_from_cache(tags)
|
||||
count = Cache.get(count_cache_key(tags))
|
||||
|
||||
if count.nil?
|
||||
if count.nil? && !CurrentUser.safe_mode? && !CurrentUser.hide_deleted_posts?
|
||||
count = select_value_sql("SELECT post_count FROM tags WHERE name = ?", tags.to_s)
|
||||
end
|
||||
|
||||
@@ -747,6 +747,13 @@ class Post < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def count_cache_key(tags)
|
||||
if CurrentUser.safe_mode?
|
||||
tags = "#{tags} rating:s".strip
|
||||
end
|
||||
if CurrentUser.hide_deleted_posts?
|
||||
tags = "#{tags} -status:deleted".strip
|
||||
end
|
||||
|
||||
"pfc:#{Cache.sanitize(tags)}"
|
||||
end
|
||||
|
||||
@@ -774,9 +781,7 @@ class Post < ActiveRecord::Base
|
||||
|
||||
def fast_count_search(tags)
|
||||
count = Post.with_timeout(500, Danbooru.config.blank_tag_search_fast_count || 1_000_000) do
|
||||
CurrentUser.without_safe_mode do
|
||||
Post.tag_match(tags).count
|
||||
end
|
||||
Post.tag_match(tags).count
|
||||
end
|
||||
if count > 0
|
||||
set_count_in_cache(tags, count)
|
||||
|
||||
Reference in New Issue
Block a user