This commit is contained in:
r888888888
2013-07-25 15:49:02 -07:00
parent e6fb0c3caf
commit ce05505699
2 changed files with 7 additions and 1 deletions

View File

@@ -46,12 +46,18 @@ class CurrentUser
Thread.current[:safe_mode]
end
def self.admin_mode?
Thread.current[:admin_mode]
end
def self.without_safe_mode
prev = Thread.current[:safe_mode]
Thread.current[:safe_mode] = false
Thread.current[:admin_mode] = true
yield
ensure
Thread.current[:safe_mode] = prev
Thread.current[:admin_mode] = false
end
def self.set_safe_mode(req)

View File

@@ -155,7 +155,7 @@ class PostQueryBuilder
relation = relation.where("posts.is_flagged = FALSE")
elsif q[:status_neg] == "deleted"
relation = relation.where("posts.is_deleted = FALSE")
elsif CurrentUser.user.hide_deleted_posts?
elsif CurrentUser.user.hide_deleted_posts? && !CurrentUser.admin_mode?
relation = relation.where("posts.is_deleted = FALSE")
end