Class: Decidim::Ai::SpamDetection::UserSpamAnalyzerJob

Inherits:
GenericSpamAnalyzerJob show all
Defined in:
decidim-ai/app/jobs/decidim/ai/spam_detection/user_spam_analyzer_job.rb

Instance Method Summary collapse

Methods included from TranslatableAttributes

#attachment?, #default_locale?

Instance Method Details

#perform(reportable) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'decidim-ai/app/jobs/decidim/ai/spam_detection/user_spam_analyzer_job.rb', line 7

def perform(reportable)
  @author = reportable

  classifier.classify(reportable.about)

  return unless classifier.score >= Decidim::Ai::SpamDetection.user_score_threshold

  Decidim::CreateUserReport.call(form, reportable)
end