Allow disabling AI assistant (#146)

* Test disabling AI assistant

* Leave "Maybe" out of it

* It's "sure" now
This commit is contained in:
Juan José Mata
2025-10-22 22:11:01 +02:00
committed by GitHub
parent 4cd737b5d9
commit e7e85748e4
4 changed files with 38 additions and 1 deletions

View File

@@ -21,9 +21,11 @@ class UsersController < ApplicationController
@user.update!(user_params.except(:redirect_to, :delete_profile_image))
@user.profile_image.purge if should_purge_profile_image?
# Add a special notice if AI was just enabled
# Add a special notice if AI was just enabled or disabled
notice = if !was_ai_enabled && @user.ai_enabled
"AI Assistant has been enabled successfully."
elsif was_ai_enabled && !@user.ai_enabled
"AI Assistant has been disabled."
else
t(".success")
end
@@ -72,6 +74,8 @@ class UsersController < ApplicationController
redirect_to goals_onboarding_path
when "trial"
redirect_to trial_onboarding_path
when "ai_prompts"
redirect_to settings_ai_prompts_path, notice: notice
else
redirect_to settings_profile_path, notice: notice
end