discourse/app/services/spam_rules_enforcer.rb

21 lines
467 B
Ruby
Raw Normal View History

# The SpamRulesEnforcer class takes action against users based on flags that their posts
# receive, their trust level, etc.
class SpamRulesEnforcer
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!
2017-11-10 12:18:08 -05:00
SpamRule::AutoSilence.new(@user).perform if @user
SpamRule::FlagSockpuppets.new(@post).perform if @post
true
end
end