Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/jobs/regular/detect_translate_post.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module Jobs
class DetectTranslatePost < ::Jobs::Base
cluster_concurrency 1
sidekiq_options retry: false

def execute(args)
Expand Down
1 change: 1 addition & 0 deletions app/jobs/regular/detect_translate_topic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module Jobs
class DetectTranslateTopic < ::Jobs::Base
cluster_concurrency 1
sidekiq_options retry: false

def execute(args)
Expand Down
2 changes: 1 addition & 1 deletion lib/translation/entry_point.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module DiscourseAi
module Translation
class EntryPoint
def inject_into(plugin)
plugin.on(:post_process_cooked) do |_, post|
plugin.on(:post_created) do |post|
if SiteSetting.discourse_ai_enabled && SiteSetting.ai_translation_enabled
Jobs.enqueue(:detect_translate_post, post_id: post.id)
end
Expand Down
5 changes: 2 additions & 3 deletions spec/lib/translation/entry_point_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@

describe "upon post process cooked" do
it "enqueues detect post locale and translate post job" do
post = Fabricate(:post)
CookedPostProcessor.new(post).post_process

post =
PostCreator.create!(Fabricate(:user), raw: "post", title: "topic", skip_validations: true)
expect_job_enqueued(job: :detect_translate_post, args: { post_id: post.id })
end

Expand Down
Loading