about summary refs log tree commit diff
path: root/app/workers/web/push_notification_worker.rb
diff options
context:
space:
mode:
authorJeong Arm <kjwonmail@gmail.com>2022-05-28 21:32:08 +0900
committerGitHub <noreply@github.com>2022-05-28 14:32:08 +0200
commitfed7380e9f6811ac069b1891546581aa4bccb122 (patch)
treef22825ef635931f3e87e2bc702e11de6fdfc44df /app/workers/web/push_notification_worker.rb
parent0ac6e5d434f9d24a5d9fb3865acd4ced0bb1bf02 (diff)
Prevent use locale with empty string (#18543)
Somehow user's locale could be an empty string, And empty string itself
are treated as true value.
Diffstat (limited to 'app/workers/web/push_notification_worker.rb')
-rw-r--r--app/workers/web/push_notification_worker.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/workers/web/push_notification_worker.rb b/app/workers/web/push_notification_worker.rb
index 57f5b5c22..1ed5bb9e0 100644
--- a/app/workers/web/push_notification_worker.rb
+++ b/app/workers/web/push_notification_worker.rb
@@ -51,7 +51,7 @@ class Web::PushNotificationWorker
   private
 
   def push_notification_json
-    json = I18n.with_locale(@subscription.locale || I18n.default_locale) do
+    json = I18n.with_locale(@subscription.locale.presence || I18n.default_locale) do
       ActiveModelSerializers::SerializableResource.new(
         @notification,
         serializer: Web::NotificationSerializer,