mirror of
https://ghfast.top/https://github.com/discourse/discourse-akismet.git
synced 2026-07-15 11:36:24 +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
710 B
Ruby
21 lines
710 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Jobs
|
|
class CheckAkismetPostVotingComment < ::Jobs::Base
|
|
def execute(args)
|
|
return if !SiteSetting.akismet_enabled?
|
|
return if !(comment = PostVotingComment.find_by(id: args[:comment_id]))
|
|
return if Reviewable.exists?(target: comment)
|
|
|
|
DistributedMutex.synchronize("akismet_post_voting_comment_#{comment.id}") do
|
|
if comment.custom_fields[DiscourseAkismet::Bouncer::AKISMET_STATE] ==
|
|
DiscourseAkismet::Bouncer::PENDING_STATE
|
|
DiscourseAkismet::PostVotingCommentsBouncer.new.perform_check(
|
|
DiscourseAkismet::AntiSpamService.client,
|
|
comment,
|
|
)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|