about summary refs log tree commit diff
path: root/app/serializers
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2019-07-21 18:10:07 +0200
committerGitHub <noreply@github.com>2019-07-21 18:10:07 +0200
commit043d52f785d8f3d0fa31cde8f5e4c1991888e887 (patch)
tree4c98819d46427adfca9deb2118fa7c8046a7aa69 /app/serializers
parentbd1545de5ee9655130e5357bb9cb6449520a6292 (diff)
Fix `alerts` booleans not being typecast correctly in push subscription (#11343)
* Fix `alerts` booleans not being typecast correctly in push subscription

Fix #10789

* Fix typo
Diffstat (limited to 'app/serializers')
-rw-r--r--app/serializers/rest/web_push_subscription_serializer.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/serializers/rest/web_push_subscription_serializer.rb b/app/serializers/rest/web_push_subscription_serializer.rb
index 7fd952a56..194cc0a8c 100644
--- a/app/serializers/rest/web_push_subscription_serializer.rb
+++ b/app/serializers/rest/web_push_subscription_serializer.rb
@@ -4,7 +4,7 @@ class REST::WebPushSubscriptionSerializer < ActiveModel::Serializer
   attributes :id, :endpoint, :alerts, :server_key
 
   def alerts
-    object.data&.dig('alerts') || {}
+    (object.data&.dig('alerts') || {}).each_with_object({}) { |(k, v), h| h[k] = ActiveModel::Type::Boolean.new.cast(v) }
   end
 
   def server_key