summaryrefslogtreecommitdiff
path: root/app/controllers/user_callouts_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/user_callouts_controller.rb')
-rw-r--r--app/controllers/user_callouts_controller.rb11
1 files changed, 3 insertions, 8 deletions
diff --git a/app/controllers/user_callouts_controller.rb b/app/controllers/user_callouts_controller.rb
index cfec9d6d905..df3e2425e9f 100644
--- a/app/controllers/user_callouts_controller.rb
+++ b/app/controllers/user_callouts_controller.rb
@@ -4,10 +4,11 @@ class UserCalloutsController < ApplicationController
feature_category :navigation
def create
- callout = ensure_callout
+ callout = Users::DismissUserCalloutService.new(
+ container: nil, current_user: current_user, params: { feature_name: feature_name }
+ ).execute
if callout.persisted?
- callout.update(dismissed_at: Time.current)
respond_to do |format|
format.json { head :ok }
end
@@ -20,12 +21,6 @@ class UserCalloutsController < ApplicationController
private
- # rubocop: disable CodeReuse/ActiveRecord
- def ensure_callout
- current_user.callouts.find_or_create_by(feature_name: UserCallout.feature_names[feature_name])
- end
- # rubocop: enable CodeReuse/ActiveRecord
-
def feature_name
params.require(:feature_name)
end