Skip to content

Commit 6a5581a

Browse files
committed
Switch conditions
1 parent 1ec2f58 commit 6a5581a

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

plugin.rb

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,21 @@ module ::DiscourseTranslator
3939
end
4040

4141
on(:post_process_cooked) do |_, post|
42-
return if SiteSetting.automatic_translation_target_languages.blank?
43-
Jobs.enqueue(:translate_translatable, type: Post, translatable_id: post.id)
42+
if SiteSetting.automatic_translation_target_languages.present?
43+
Jobs.enqueue(:translate_translatable, type: Post, translatable_id: post.id)
44+
end
4445
end
4546

4647
on(:topic_created) do |topic|
47-
Jobs.enqueue(:translate_translatable, type: Topic, translatable_id: topic.id)
48+
if SiteSetting.automatic_translation_target_languages.present?
49+
Jobs.enqueue(:translate_translatable, type: Topic, translatable_id: topic.id)
50+
end
4851
end
4952

5053
on(:topic_edited) do |topic|
51-
Jobs.enqueue(:translate_translatable, type: Topic, translatable_id: topic.id)
54+
if SiteSetting.automatic_translation_target_languages.present?
55+
Jobs.enqueue(:translate_translatable, type: Topic, translatable_id: topic.id)
56+
end
5257
end
5358

5459
add_to_serializer :post, :can_translate do

0 commit comments

Comments
 (0)