mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Automatically flag someone as a spammer if their posts get at least X spam flags from N users while their trust level is 'new user'. Staff can clear and set this status from the user record in admin.
This commit is contained in:
@@ -133,6 +133,14 @@ class Guardian
|
||||
can_administer?(user) && not(user.moderator?)
|
||||
end
|
||||
|
||||
def can_block_user?(user)
|
||||
user && is_staff? && not(user.staff?)
|
||||
end
|
||||
|
||||
def can_unblock_user?(user)
|
||||
user && is_staff?
|
||||
end
|
||||
|
||||
def can_delete_user?(user_to_delete)
|
||||
can_administer?(user_to_delete) && user_to_delete.post_count <= 0
|
||||
end
|
||||
@@ -211,8 +219,16 @@ class Guardian
|
||||
is_staff?
|
||||
end
|
||||
|
||||
def can_create_topic?(parent)
|
||||
can_create_post?(parent)
|
||||
end
|
||||
|
||||
def can_create_post?(parent)
|
||||
!SpamRulesEnforcer.block?(@user)
|
||||
end
|
||||
|
||||
def can_create_post_on_topic?(topic)
|
||||
is_staff? || not(topic.closed? || topic.archived?)
|
||||
is_staff? || (not(topic.closed? || topic.archived?) && can_create_post?(topic))
|
||||
end
|
||||
|
||||
# Editing Methods
|
||||
|
||||
Reference in New Issue
Block a user