We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f6ea0b4 commit c7b3148Copy full SHA for c7b3148
lib/discourse_translator/guardian_extension.rb
@@ -22,7 +22,7 @@ def can_detect_language?(post)
22
end
23
24
def can_translate?(post)
25
- return false if post.user.bot?
+ return false if post.user&.bot?
26
return false if !user_group_allow_translate?
27
return false if post.locale_matches?(I18n.locale)
28
spec/lib/guardian_extension_spec.rb
@@ -244,5 +244,11 @@
244
245
246
247
+
248
+ it "does not error out when post user is deleted" do
249
+ post.update(user: nil)
250
251
+ expect { guardian.can_translate?(post) }.not_to raise_error
252
+ end
253
254
0 commit comments