Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2018-02-03 00:51:03 +0300
committerMatija Čupić <matteeyah@gmail.com>2018-02-03 00:51:03 +0300
commit648826721f13ee4309a11638e538d96006648b39 (patch)
tree9e2cb1b728208671c4d653d32223a02d19f3fe82 /app/controllers/user_callouts_controller.rb
parent838cc0907c963a025553d639283b3bbf8140dae8 (diff)
Rename Callout to UserCallout
Diffstat (limited to 'app/controllers/user_callouts_controller.rb')
-rw-r--r--app/controllers/user_callouts_controller.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/app/controllers/user_callouts_controller.rb b/app/controllers/user_callouts_controller.rb
new file mode 100644
index 00000000000..69dc444f13a
--- /dev/null
+++ b/app/controllers/user_callouts_controller.rb
@@ -0,0 +1,23 @@
+class UserCalloutsController < ApplicationController
+ def create
+ if ensure_callout
+ respond_to do |format|
+ format.json { head :ok }
+ end
+ else
+ respond_to do |format|
+ format.json { head :bad_request }
+ end
+ end
+ end
+
+ private
+
+ def ensure_callout
+ current_user.callouts.find_or_create_by(feature_name: callout_param)
+ end
+
+ def callout_param
+ params.require(:feature_name)
+ end
+end