mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-12-11 00:02:05 -05:00
25 lines
583 B
Ruby
25 lines
583 B
Ruby
# The SpamRulesEnforcer class takes action against users based on flags that their posts
|
|
# receive, their trust level, etc.
|
|
class SpamRulesEnforcer
|
|
|
|
# The exclamation point means that this method may make big changes to posts and users.
|
|
def self.enforce!(arg)
|
|
SpamRulesEnforcer.new(arg).enforce!
|
|
end
|
|
|
|
def initialize(arg)
|
|
@user = arg if arg.is_a?(User)
|
|
@post = arg if arg.is_a?(Post)
|
|
end
|
|
|
|
def enforce!
|
|
if @user
|
|
SpamRule::AutoBlock.new(@user).perform
|
|
end
|
|
if @post
|
|
SpamRule::FlagSockpuppets.new(@post).perform
|
|
end
|
|
true
|
|
end
|
|
|
|
end
|