2013-05-31 23:41:40 +08:00
|
|
|
# The SpamRulesEnforcer class takes action against users based on flags that their posts
|
|
|
|
# receive, their trust level, etc.
|
|
|
|
class SpamRulesEnforcer
|
|
|
|
|
2013-10-12 01:33:23 +08:00
|
|
|
def self.enforce!(arg)
|
|
|
|
SpamRulesEnforcer.new(arg).enforce!
|
2013-05-31 23:41:40 +08:00
|
|
|
end
|
|
|
|
|
2013-10-12 01:33:23 +08:00
|
|
|
def initialize(arg)
|
|
|
|
@user = arg if arg.is_a?(User)
|
|
|
|
@post = arg if arg.is_a?(Post)
|
2013-05-31 23:41:40 +08:00
|
|
|
end
|
|
|
|
|
2013-10-12 01:33:23 +08:00
|
|
|
def enforce!
|
2017-11-11 01:18:08 +08:00
|
|
|
SpamRule::AutoSilence.new(@user).perform if @user
|
2014-11-17 19:04:29 +08:00
|
|
|
SpamRule::FlagSockpuppets.new(@post).perform if @post
|
2013-10-12 01:33:23 +08:00
|
|
|
true
|
2013-05-31 23:41:40 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|