From fed7380e9f6811ac069b1891546581aa4bccb122 Mon Sep 17 00:00:00 2001 From: Jeong Arm Date: Sat, 28 May 2022 21:32:08 +0900 Subject: 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. --- app/workers/web/push_notification_worker.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/workers/web/push_notification_worker.rb') 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, -- cgit