2013-05-31 11:41:40 -04:00
|
|
|
# The SpamRulesEnforcer class takes action against users based on flags that their posts
|
|
|
|
# receive, their trust level, etc.
|
|
|
|
class SpamRulesEnforcer
|
|
|
|
|
2013-10-11 13:33:23 -04:00
|
|
|
def self.enforce!(arg)
|
|
|
|
SpamRulesEnforcer.new(arg).enforce!
|
2013-05-31 11:41:40 -04:00
|
|
|
end
|
|
|
|
|
2013-10-11 13:33:23 -04:00
|
|
|
def initialize(arg)
|
|
|
|
@user = arg if arg.is_a?(User)
|
|
|
|
@post = arg if arg.is_a?(Post)
|
2013-05-31 11:41:40 -04:00
|
|
|
end
|
|
|
|
|
2013-10-11 13:33:23 -04:00
|
|
|
def enforce!
|
2018-08-20 09:08:12 -04:00
|
|
|
I18n.with_locale(SiteSetting.default_locale) do
|
|
|
|
SpamRule::AutoSilence.new(@user).perform if @user
|
|
|
|
SpamRule::FlagSockpuppets.new(@post).perform if @post
|
|
|
|
end
|
2013-10-11 13:33:23 -04:00
|
|
|
true
|
2013-05-31 11:41:40 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|