mirror of https://github.com/mastodon/mastodon
Further refactor
This commit is contained in:
parent
0a7de5d1ee
commit
ab12a443a2
|
@ -43,11 +43,11 @@ class Api::V1::Push::SubscriptionsController < Api::BaseController
|
|||
private
|
||||
|
||||
def destroy_web_push_subscriptions!
|
||||
Web::PushSubscription.where(access_token_id: doorkeeper_token.id).destroy_all
|
||||
doorkeeper_token.web_push_subscriptions.destroy_all
|
||||
end
|
||||
|
||||
def set_push_subscription
|
||||
@push_subscription = Web::PushSubscription.find_by(access_token_id: doorkeeper_token.id)
|
||||
@push_subscription = doorkeeper_token.web_push_subscriptions.first
|
||||
end
|
||||
|
||||
def check_push_subscription
|
||||
|
|
|
@ -6,6 +6,8 @@ module AccessTokenExtension
|
|||
included do
|
||||
include Redisable
|
||||
|
||||
has_many :web_push_subscriptions, class_name: 'Web::PushSubscription', inverse_of: :access_token
|
||||
|
||||
after_commit :push_to_streaming_api
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue