diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2018-05-19 21:05:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-19 21:05:08 +0200 |
commit | 8378b72ebacc51e5e090faa527462b801e4c2803 (patch) | |
tree | 92deefbf0e199119a486055ac18774d5a5b410f0 /app/controllers/oauth/tokens_controller.rb | |
parent | 5910eb9b61da6eacf6b534d831da6e2f698e2703 (diff) |
Ensure push subscription is immediately removed when application is revoked (#7548)
* Ensure push subscription is immediately removed when application is revoked * When token is revoked from app, unsubscribe too
Diffstat (limited to 'app/controllers/oauth/tokens_controller.rb')
-rw-r--r-- | app/controllers/oauth/tokens_controller.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/controllers/oauth/tokens_controller.rb b/app/controllers/oauth/tokens_controller.rb new file mode 100644 index 000000000..fa6d58f25 --- /dev/null +++ b/app/controllers/oauth/tokens_controller.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class Oauth::TokensController < Doorkeeper::TokensController + def revoke + unsubscribe_for_token if authorized? && token.accessible? + super + end + + private + + def unsubscribe_for_token + Web::PushSubscription.where(access_token_id: token.id).delete_all + end +end |