diff options
author | Sorin Davidoi <sorin.davidoi@gmail.com> | 2017-07-18 16:25:40 +0200 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-07-18 16:25:40 +0200 |
commit | 8387b3928ec7658192907da79df65e65aaa8a7fc (patch) | |
tree | 87df6e1941444eae5ae44856cd0f2e4e857213ac /app/models | |
parent | afa52e4d636f8fdc4b21b90e4f006d8ea434b4e9 (diff) |
fix(push-subscriptions): Refactor how Sidekiq jobs are handled (#4226)
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/web/push_subscription.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/app/models/web/push_subscription.rb b/app/models/web/push_subscription.rb index 4440706a6..baf6a1ece 100644 --- a/app/models/web/push_subscription.rb +++ b/app/models/web/push_subscription.rb @@ -12,6 +12,9 @@ # updated_at :datetime not null # +require 'webpush' +require_relative '../../models/setting' + class Web::PushSubscription < ApplicationRecord include RoutingHelper include StreamEntriesHelper @@ -37,7 +40,6 @@ class Web::PushSubscription < ApplicationRecord nsfw = notification.target_status.nil? || notification.target_status.spoiler_text.empty? ? nil : notification.target_status.spoiler_text # TODO: Make sure that the payload does not exceed 4KB - Webpush::PayloadTooLarge - # TODO: Queue the requests - Webpush::TooManyRequests Webpush.payload_send( message: JSON.generate( title: title, @@ -59,7 +61,7 @@ class Web::PushSubscription < ApplicationRecord p256dh: key_p256dh, auth: key_auth, 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, }, @@ -166,7 +168,7 @@ class Web::PushSubscription < ApplicationRecord p256dh: key_p256dh, auth: key_auth, 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, }, |