Skip to content

Commit

Permalink
Fix alerts booleans not being typecast correctly in push subscripti…
Browse files Browse the repository at this point in the history
…on (mastodon#11343)

* Fix `alerts` booleans not being typecast correctly in push subscription

Fix mastodon#10789

* Fix typo
  • Loading branch information
Gargron authored and hiyuki2578 committed Oct 2, 2019
1 parent a6c844a commit 832eb30
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/serializers/rest/web_push_subscription_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 832eb30

Please sign in to comment.