diff options
author | Matija Čupić <matteeyah@gmail.com> | 2018-02-03 00:16:24 +0100 |
---|---|---|
committer | Matija Čupić <matteeyah@gmail.com> | 2018-02-03 00:18:25 +0100 |
commit | 20714ee90232b5577fc99f2a773ddccf71482c08 (patch) | |
tree | 87d84e442bdf9bee58d1ef6f67d658035ac1e777 /app/controllers/user_callouts_controller.rb | |
parent | 79efb9d0b2d08764ac1a7b0b8e3004c6da9236c1 (diff) | |
download | gitlab-ce-20714ee90232b5577fc99f2a773ddccf71482c08.tar.gz |
Change UserCallout feautre_name to enum
Diffstat (limited to 'app/controllers/user_callouts_controller.rb')
-rw-r--r-- | app/controllers/user_callouts_controller.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/controllers/user_callouts_controller.rb b/app/controllers/user_callouts_controller.rb index 69dc444f13a..aa048a9a1fc 100644 --- a/app/controllers/user_callouts_controller.rb +++ b/app/controllers/user_callouts_controller.rb @@ -1,6 +1,6 @@ class UserCalloutsController < ApplicationController def create - if ensure_callout + if check_feature_name && ensure_callout respond_to do |format| format.json { head :ok } end @@ -13,6 +13,10 @@ class UserCalloutsController < ApplicationController private + def check_feature_name + UserCallout.feature_names.keys.include?(callout_param) + end + def ensure_callout current_user.callouts.find_or_create_by(feature_name: callout_param) end |