mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-08-06 13:13:28 +00:00
21 lines
536 B
Ruby
21 lines
536 B
Ruby
# frozen_string_literal: true
|
|
|
|
module DiscourseAi
|
|
module Nsfw
|
|
class EntryPoint
|
|
def inject_into(plugin)
|
|
nsfw_detection_cb =
|
|
Proc.new do |post|
|
|
if SiteSetting.ai_nsfw_detection_enabled &&
|
|
DiscourseAi::Nsfw::Classification.new.can_classify?(post)
|
|
Jobs.enqueue(:evaluate_post_uploads, post_id: post.id)
|
|
end
|
|
end
|
|
|
|
plugin.on(:post_created, &nsfw_detection_cb)
|
|
plugin.on(:post_edited, &nsfw_detection_cb)
|
|
end
|
|
end
|
|
end
|
|
end
|