Add support for standard webpush (#33528)
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
		@@ -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) }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user