FIX: send a PM to moderators when a post has been flagged as sockpuppet

This commit is contained in:
Régis Hanol
2015-02-05 19:58:49 +01:00
parent d0b83c6fb2
commit 2fcd199f48
4 changed files with 28 additions and 10 deletions

View File

@@ -5,7 +5,7 @@ class SpamRule::FlagSockpuppets
end
def perform
if SiteSetting.flag_sockpuppets and reply_is_from_sockpuppet?
if SiteSetting.flag_sockpuppets && reply_is_from_sockpuppet?
flag_sockpuppet_users
true
else
@@ -14,16 +14,17 @@ class SpamRule::FlagSockpuppets
end
def reply_is_from_sockpuppet?
return false if @post.post_number and @post.post_number == 1
return false if @post.try(:post_number) == 1
first_post = @post.topic.posts.by_post_number.first
return false if first_post.user.nil?
!first_post.user.staff? and !@post.user.staff? and
@post.user != first_post.user and
@post.user.ip_address == first_post.user.ip_address and
@post.user.new_user? and
!ScreenedIpAddress.is_whitelisted?(@post.user.ip_address)
!first_post.user.staff? &&
!@post.user.staff? &&
@post.user != first_post.user &&
@post.user.ip_address == first_post.user.ip_address &&
@post.user.new_user? &&
!ScreenedIpAddress.is_whitelisted?(@post.user.ip_address)
end
def flag_sockpuppet_users
@@ -34,4 +35,4 @@ class SpamRule::FlagSockpuppets
end
end
end
end