]> cat aescling's git repositories - mastodon.git/commitdiff
Fix WebPush (regression from #4524) (#4778)
authorunarist <m.unarist@gmail.com>
Sat, 2 Sep 2017 14:50:42 +0000 (23:50 +0900)
committerEugen Rochko <eugen@zeonfederated.com>
Sat, 2 Sep 2017 14:50:42 +0000 (16:50 +0200)
* Fix NoMethodError in Web::PushSubscription

```
undefined method `site_contact_email' for #<Class:0x00005976d13c40>

/usr/local/bundle/gems/activerecord-5.1.3/lib/active_record/dynamic_matchers.rb:22:in `method_missing'
/usr/local/bundle/gems/attr_encrypted-3.0.3/lib/attr_encrypted.rb:295:in `method_missing'
/usr/local/bundle/gems/attr_encrypted-3.0.3/lib/attr_encrypted/adapters/active_record.rb:129:in `method_missing_with_attr_encrypted'
/mastodon/app/models/web/push_subscription.rb:53:in `push_payload'
```

* Specify serializer in Web::NotificationSerializer

app/models/web/push_subscription.rb
app/serializers/web/notification_serializer.rb

index 79f782114459cf86b2c1b36030e74161a7d77e35..cb15dfa3703de38a5bfc27d6066bd0975fb919ee 100644 (file)
@@ -50,7 +50,7 @@ class Web::PushSubscription < ApplicationRecord
       auth: key_auth,
       ttl: ttl,
       vapid: {
-        subject: "mailto:#{Setting.site_contact_email}",
+        subject: "mailto:#{::Setting.site_contact_email}",
         private_key: Rails.configuration.x.vapid_private_key,
         public_key: Rails.configuration.x.vapid_public_key,
       }
index 21a09f01e6535f0d655d33f61b6fa7300fac95cb..e5524fe7a7b9da5547cb015be4899548f3a2e9d0 100644 (file)
@@ -121,7 +121,7 @@ class Web::NotificationSerializer < ActiveModel::Serializer
   attributes :title, :image, :badge, :tag,
              :timestamp, :icon
 
-  has_one :data
+  has_one :data, serializer: DataSerializer
 
   def title
     case object.type