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.
This commit is contained in:
Jeong Arm
2022-05-28 21:32:08 +09:00
committed by GitHub
parent 0ac6e5d434
commit fed7380e9f
3 changed files with 26 additions and 20 deletions

View File

@@ -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,