diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2018-02-05 14:24:43 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2018-02-05 14:24:43 +0000 |
commit | 9edd95658308f3e0e8e6df6eb829555a3cb418d1 (patch) | |
tree | 9b5d96752c3eb767c603bdf12f381abc9604d0dd /app/controllers | |
parent | bedfc7b103c25cd6b9aada350142549160e41a5e (diff) | |
parent | f24705212791072a93edd4f7b1c530507b6a2c49 (diff) | |
download | gitlab-ce-9edd95658308f3e0e8e6df6eb829555a3cb418d1.tar.gz |
Merge branch 'persistent-callouts' into 'master'
Add backend for persistently dismissible callouts
See merge request gitlab-org/gitlab-ce!16735
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/user_callouts_controller.rb | 23 |
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..18cde4a7b1a --- /dev/null +++ b/app/controllers/user_callouts_controller.rb @@ -0,0 +1,23 @@ +class UserCalloutsController < ApplicationController + def create + if ensure_callout.persisted? + 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: UserCallout.feature_names[feature_name]) + end + + def feature_name + params.require(:feature_name) + end +end |