Add button to delete a spammer in the flag modal

Add SiteSettings: delete_user_max_age, delete_all_posts_max. Add delete spammer button to admin flags UI
Moderators can delete users too
This commit is contained in:
Neil Lalonde
2013-07-26 15:40:08 -04:00
parent e076158789
commit 4fd5087f91
18 changed files with 265 additions and 37 deletions

View File

@ -151,7 +151,7 @@ class Guardian
end
def can_delete_user?(user)
can_administer?(user)
user && is_staff? && !user.admin? && user.created_at > SiteSetting.delete_user_max_age.to_i.days.ago
end
# Can we see who acted on a post in a particular way?
@ -203,7 +203,7 @@ class Guardian
end
def can_delete_all_posts?(user)
is_staff? && user.created_at >= 7.days.ago
is_staff? && user && !user.admin? && user.created_at >= 7.days.ago && user.post_count <= SiteSetting.delete_all_posts_max.to_i
end
def can_remove_allowed_users?(topic)