From 563f834287c1096329bee378b4a82d86194e7f6b Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Wed, 25 Oct 2023 02:51:49 +0200 Subject: [PATCH] Remove `Ajax::SubscriptionController` --- app/controllers/ajax/subscription_controller.rb | 17 ----------------- config/routes.rb | 2 -- 2 files changed, 19 deletions(-) delete mode 100644 app/controllers/ajax/subscription_controller.rb diff --git a/app/controllers/ajax/subscription_controller.rb b/app/controllers/ajax/subscription_controller.rb deleted file mode 100644 index fd574e78..00000000 --- a/app/controllers/ajax/subscription_controller.rb +++ /dev/null @@ -1,17 +0,0 @@ -class Ajax::SubscriptionController < AjaxController - before_action :authenticate_user! - - def subscribe - params.require :answer - @response[:status] = :okay - result = Subscription.subscribe(current_user, Answer.find(params[:answer])) - @response[:success] = result.present? - end - - def unsubscribe - params.require :answer - @response[:status] = :okay - result = Subscription.unsubscribe(current_user, Answer.find(params[:answer])) - @response[:success] = result&.destroyed? || false - end -end diff --git a/config/routes.rb b/config/routes.rb index 5004d57c..faaabed1 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -128,8 +128,6 @@ Rails.application.routes.draw do post "/create_list", to: "list#create", as: :create_list post "/destroy_list", to: "list#destroy", as: :destroy_list post "/list_membership", to: "list#membership", as: :list_membership - post "/subscribe", to: "subscription#subscribe", as: :subscribe_answer - post "/unsubscribe", to: "subscription#unsubscribe", as: :unsubscribe_answer get "/webpush/key", to: "web_push#key", as: :webpush_key post "/webpush/check", to: "web_push#check", as: :webpush_check post "/webpush", to: "web_push#subscribe", as: :webpush_subscribe