mirror of
https://github.com/yingziwu/mastodon.git
synced 2026-02-04 03:25:14 +00:00
Automatically remove invalid Web::PushSubscriptions (#35987)
This commit is contained in:
parent
14cb5ff881
commit
4c2a2c27c1
2 changed files with 31 additions and 0 deletions
|
|
@ -15,6 +15,15 @@ class Web::PushNotificationWorker
|
|||
|
||||
return if @notification.updated_at < TTL.ago
|
||||
|
||||
# Clean up old Web::PushSubscriptions that were added before validation of
|
||||
# the endpoint and keys: #30542, #30540
|
||||
unless @subscription.valid?
|
||||
Rails.logger.debug { "Web::PushSubscription is invalid, removing: #{subscription_id}" }
|
||||
@subscription.destroy!
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
# Polymorphically associated activity could have been deleted
|
||||
# in the meantime, so we have to double-check before proceeding
|
||||
return unless @notification.activity.present? && @subscription.pushable?(@notification)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue