mirror of
https://github.com/discourse/discourse.git
synced 2024-12-01 05:33:47 +08:00
21 lines
467 B
Ruby
21 lines
467 B
Ruby
# 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!
|
|
SpamRule::AutoSilence.new(@user).perform if @user
|
|
SpamRule::FlagSockpuppets.new(@post).perform if @post
|
|
true
|
|
end
|
|
|
|
end
|