diff options
author | David Yip <yipdw@member.fsf.org> | 2018-05-20 03:01:44 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-20 03:01:44 -0500 |
commit | 56a3d2b64bb096bc771c1d3c043a9d44d41c3291 (patch) | |
tree | 6917de2e59e69f5ad0dc9b1471a7c7c8659c1af8 /app/controllers | |
parent | 625c4f36ef394215e65e19157bfaf60e7de94b5f (diff) | |
parent | b481e4fac1c564b8008f6f1d0eea1727ec9faa08 (diff) |
Merge pull request #494 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/oauth/authorized_applications_controller.rb | 5 | ||||
-rw-r--r-- | app/controllers/oauth/tokens_controller.rb | 14 |
2 files changed, 19 insertions, 0 deletions
diff --git a/app/controllers/oauth/authorized_applications_controller.rb b/app/controllers/oauth/authorized_applications_controller.rb index f95d672ec..1e420b3e7 100644 --- a/app/controllers/oauth/authorized_applications_controller.rb +++ b/app/controllers/oauth/authorized_applications_controller.rb @@ -9,6 +9,11 @@ class Oauth::AuthorizedApplicationsController < Doorkeeper::AuthorizedApplicatio include Localized + def destroy + Web::PushSubscription.unsubscribe_for(params[:id], current_resource_owner) + super + end + private def store_current_location 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 |