Skip to content

Commit

Permalink
Switch conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
nattsw committed Feb 13, 2025
1 parent 1ec2f58 commit 6a5581a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,21 @@ module ::DiscourseTranslator
end

on(:post_process_cooked) do |_, post|
return if SiteSetting.automatic_translation_target_languages.blank?
Jobs.enqueue(:translate_translatable, type: Post, translatable_id: post.id)
if SiteSetting.automatic_translation_target_languages.present?
Jobs.enqueue(:translate_translatable, type: Post, translatable_id: post.id)
end
end

on(:topic_created) do |topic|
Jobs.enqueue(:translate_translatable, type: Topic, translatable_id: topic.id)
if SiteSetting.automatic_translation_target_languages.present?
Jobs.enqueue(:translate_translatable, type: Topic, translatable_id: topic.id)
end
end

on(:topic_edited) do |topic|
Jobs.enqueue(:translate_translatable, type: Topic, translatable_id: topic.id)
if SiteSetting.automatic_translation_target_languages.present?
Jobs.enqueue(:translate_translatable, type: Topic, translatable_id: topic.id)
end
end

add_to_serializer :post, :can_translate do
Expand Down

0 comments on commit 6a5581a

Please sign in to comment.