From 1361a8c27933dc9ce66064cd6910bc9e18ce24bd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 13 Apr 2026 21:23:55 +0000 Subject: [PATCH] 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> --- app/controllers/users_controller.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 234d81f00..cfcaa6ffe 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -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."