users: remove 'hide deleted posts' account setting.
This setting automatically added the `-status:deleted` metatag to all searches. This meant deleted posts were filtered out at the database level, rather than at the html level. This way searches wouldn't have less-than-full pages. The cost was that searches were slower, mainly because post counts weren't cached. Normally when you search for a tag, we can get the post count from the tags table. If the search is actually like `touhou -status:deleted`, then we don't know the count and we have to calculate it on demand. This option is being removed because it did the opposite of what people thought it did. People thought it made deleted posts visible, when actually it made them more hidden.
This commit is contained in:
@@ -920,7 +920,7 @@ class Post < ApplicationRecord
|
||||
end
|
||||
|
||||
def sample(query, sample_size)
|
||||
user_tag_match(query, safe_mode: false, hide_deleted_posts: false).reorder(:md5).limit(sample_size)
|
||||
user_tag_match(query, safe_mode: false).reorder(:md5).limit(sample_size)
|
||||
end
|
||||
|
||||
# unflattens the tag_string into one tag per row.
|
||||
@@ -1282,13 +1282,13 @@ class Post < ApplicationRecord
|
||||
|
||||
# Perform a tag search as an anonymous user. No tag limit is enforced.
|
||||
def anon_tag_match(query)
|
||||
user_tag_match(query, User.anonymous, tag_limit: nil, safe_mode: false, hide_deleted_posts: false)
|
||||
user_tag_match(query, User.anonymous, tag_limit: nil, safe_mode: false)
|
||||
end
|
||||
|
||||
# Perform a tag search as the system user, DanbooruBot. The search will
|
||||
# have moderator-level permissions. No tag limit is enforced.
|
||||
def system_tag_match(query)
|
||||
user_tag_match(query, User.system, tag_limit: nil, safe_mode: false, hide_deleted_posts: false)
|
||||
user_tag_match(query, User.system, tag_limit: nil, safe_mode: false)
|
||||
end
|
||||
|
||||
# Perform a tag search as the current user, or as another user.
|
||||
@@ -1298,10 +1298,9 @@ class Post < ApplicationRecord
|
||||
# @param tag_limit [Integer] the maximum number of tags allowed per search.
|
||||
# An exception will be raised if the search has too many tags.
|
||||
# @param safe_mode [Boolean] if true, automatically add rating:s to the search
|
||||
# @param hide_deleted_posts [Boolean] if true, automatically add -status:deleted to the search
|
||||
# @return [ActiveRecord::Relation<Post>] the set of resulting posts
|
||||
def user_tag_match(query, user = CurrentUser.user, tag_limit: user.tag_query_limit, safe_mode: CurrentUser.safe_mode?, hide_deleted_posts: user.hide_deleted_posts?)
|
||||
post_query = PostQuery.normalize(query, current_user: user, tag_limit: tag_limit, safe_mode: safe_mode, hide_deleted_posts: hide_deleted_posts)
|
||||
def user_tag_match(query, user = CurrentUser.user, tag_limit: user.tag_query_limit, safe_mode: CurrentUser.safe_mode?)
|
||||
post_query = PostQuery.normalize(query, current_user: user, tag_limit: tag_limit, safe_mode: safe_mode)
|
||||
post_query.with_implicit_metatags.posts
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user