Fix rule prompt toggle: clear dismissed_at when re-enabling prompts

Agent-Logs-Url: https://github.com/we-promise/sure/sessions/0a0cda83-1062-4c5e-bc69-5751fb13df0e

Co-authored-by: jjmata <187772+jjmata@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-04-13 21:23:55 +00:00
committed by GitHub
parent 2c5bbc42b4
commit 1361a8c279

View File

@@ -30,6 +30,12 @@ class UsersController < ApplicationController
@user.update!(user_params.except(:redirect_to, :delete_profile_image))
@user.profile_image.purge if should_purge_profile_image?
# When re-enabling rule prompts, clear the dismissed_at timestamp so the
# 24-hour cooldown doesn't prevent the prompt from appearing immediately.
if @user.saved_change_to_rule_prompts_disabled?(from: true, to: false)
@user.update_column(:rule_prompt_dismissed_at, nil)
end
# 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."