Add support for standard webpush (#33528)
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
ee4edbb94f
commit
4a2813158d
12 changed files with 167 additions and 46 deletions
|
@ -1,7 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class REST::WebPushSubscriptionSerializer < ActiveModel::Serializer
|
||||
attributes :id, :endpoint, :alerts, :server_key, :policy
|
||||
attributes :id, :endpoint, :standard, :alerts, :server_key, :policy
|
||||
|
||||
delegate :standard, to: :object
|
||||
|
||||
def alerts
|
||||
(object.data&.dig('alerts') || {}).each_with_object({}) { |(k, v), h| h[k] = ActiveModel::Type::Boolean.new.cast(v) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue