FEATURE: allow admin to delete all posts by a user irrespectively (#14128)

This commit allows admin to delete all posts by a user irrespective of
site settings `delete_user_max_post_age` and `delete_all_posts_max`.
This commit is contained in:
Arpit Jalan
2021-08-25 10:14:22 +05:30
committed by GitHub
parent f66007ec83
commit 419d71abcb
8 changed files with 173 additions and 82 deletions

View File

@@ -100,8 +100,9 @@ module PostGuardian
is_staff? &&
user &&
!user.admin? &&
(user.first_post_created_at.nil? || user.first_post_created_at >= SiteSetting.delete_user_max_post_age.days.ago) &&
user.post_count <= SiteSetting.delete_all_posts_max.to_i
(is_admin? ||
((user.first_post_created_at.nil? || user.first_post_created_at >= SiteSetting.delete_user_max_post_age.days.ago) &&
user.post_count <= SiteSetting.delete_all_posts_max.to_i))
end
def can_create_post?(parent)