summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/callouts_controller.rb27
-rw-r--r--config/routes.rb5
2 files changed, 32 insertions, 0 deletions
diff --git a/app/controllers/callouts_controller.rb b/app/controllers/callouts_controller.rb
new file mode 100644
index 00000000000..a7bccfcce78
--- /dev/null
+++ b/app/controllers/callouts_controller.rb
@@ -0,0 +1,27 @@
+class CalloutsController < ApplicationController
+ before_action :callout, only: [:dismiss]
+
+ def dismiss
+ respond_to do |format|
+ format.json do
+ if @callout
+ @callout.update(dismissed_state: true)
+ else
+ Callout.create(feature_name: callout_param, dismissed_state: true, user: current_user)
+ end
+
+ head :ok
+ end
+ end
+ end
+
+ private
+
+ def callout
+ @callout = Callout.find_by(user: current_user, feature_name: callout_param)
+ end
+
+ def callout_param
+ params.require(:feature_name)
+ end
+end
diff --git a/config/routes.rb b/config/routes.rb
index f162043dd5e..f768bcebc7e 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -90,6 +90,11 @@ Rails.application.routes.draw do
# Notification settings
resources :notification_settings, only: [:create, :update]
+ # Callouts
+ namespace :callouts do
+ post :dismiss
+ end
+
draw :google_api
draw :import
draw :uploads