about summary refs log tree commit diff
path: root/app/controllers/oauth/tokens_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/oauth/tokens_controller.rb')
-rw-r--r--app/controllers/oauth/tokens_controller.rb14
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