2023-02-24 11:25:02 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2023-03-14 15:03:50 -04:00
|
|
|
module ::DiscourseAi
|
2023-02-28 09:17:03 -05:00
|
|
|
class PostClassificator < Classificator
|
2023-02-24 11:25:02 -05:00
|
|
|
private
|
|
|
|
|
2023-03-07 13:39:28 -05:00
|
|
|
def flag!(post, classification, verdicts, accuracies)
|
|
|
|
post.hide!(ReviewableScore.types[:inappropriate])
|
2023-02-24 11:25:02 -05:00
|
|
|
|
2023-03-07 13:39:28 -05:00
|
|
|
reviewable =
|
2023-03-14 15:03:50 -04:00
|
|
|
ReviewableAiPost.needs_review!(
|
2023-03-07 13:39:28 -05:00
|
|
|
created_by: Discourse.system_user,
|
|
|
|
target: post,
|
|
|
|
reviewable_by_moderator: true,
|
|
|
|
potential_spam: false,
|
|
|
|
payload: {
|
|
|
|
classification: classification,
|
|
|
|
accuracies: accuracies,
|
|
|
|
verdicts: verdicts,
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
add_score(reviewable)
|
2023-02-24 11:25:02 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|