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!
|
2017-11-10 12:18:08 -05:00
|
|
|
SpamRule::AutoSilence.new(@user).perform if @user
|
2014-11-17 06:04:29 -05:00
|
|
|
SpamRule::FlagSockpuppets.new(@post).perform if @post
|
2013-10-11 13:33:23 -04:00
|
|
|
true
|
2013-05-31 11:41:40 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|