2023-02-23 09:08:34 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Jobs
|
2023-02-24 05:53:43 -05:00
|
|
|
class EvaluatePostUploads < ::Jobs::Base
|
2023-02-23 09:08:34 -05:00
|
|
|
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
|