Add support for standard webpush (#33528)

Co-authored-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
S1m 2025-01-14 10:14:00 +01:00 committed by GitHub
parent ee4edbb94f
commit 4a2813158d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 167 additions and 46 deletions

View file

@ -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) }