discourse-ai/lib/shared/post_classificator.rb

27 lines
627 B
Ruby
Raw Normal View History

# frozen_string_literal: true
module ::DiscourseAI
class PostClassificator < Classificator
private
def flag!(post, classification, verdicts, accuracies)
post.hide!(ReviewableScore.types[:inappropriate])
reviewable =
ReviewableAIPost.needs_review!(
created_by: Discourse.system_user,
target: post,
reviewable_by_moderator: true,
potential_spam: false,
payload: {
classification: classification,
accuracies: accuracies,
verdicts: verdicts,
},
)
add_score(reviewable)
end
end
end