mirror of
https://ghfast.top/https://github.com/discourse/discourse-akismet.git
synced 2026-07-16 11:46:29 +08:00
* FEATURE: Implement Akismet flag and review system for PostVotingComments * polished bugs and completed reviewables implementation * adding test plugin dependecies * rubocop fix * syntax tree fix * deleted comments * added requested changes * linter fixes * refactored #before_check in post voting bouncer
21 lines
662 B
Ruby
21 lines
662 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Jobs
|
|
class CheckAkismetUser < ::Jobs::Base
|
|
def execute(args)
|
|
return if !SiteSetting.akismet_enabled?
|
|
return if !(user = User.includes(:user_profile).find_by(id: args[:user_id]))
|
|
return if Reviewable.exists?(target: user)
|
|
|
|
DistributedMutex.synchronize("akismet_user_#{user.id}") do
|
|
if user.custom_fields[DiscourseAkismet::Bouncer::AKISMET_STATE] ==
|
|
DiscourseAkismet::Bouncer::PENDING_STATE
|
|
DiscourseAkismet::UsersBouncer.new.perform_check(
|
|
DiscourseAkismet::AntiSpamService.client,
|
|
user,
|
|
)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|