mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-03-09 11:48:47 +00:00
18 lines
456 B
Ruby
18 lines
456 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Jobs
|
|
class EvaluatePostUploads < ::Jobs::Base
|
|
def execute(args)
|
|
upload = Upload.find_by_id(args[:upload_id])
|
|
|
|
return unless upload
|
|
|
|
result = DiscourseAI::NSFW::Evaluation.new.perform(upload)
|
|
|
|
# FIXME(roman): This is a simplistic action just to create
|
|
# the basic flow. We'll introduce flagging capabilities in the future.
|
|
upload.destroy! if result[:verdict]
|
|
end
|
|
end
|
|
end
|