fix(rules): stop "Dismiss" on the rule prompt silently snoozing all prompts

Merged
SC
2mo ago
+113-13

Summary

After you change a transaction's category, Sure offers to create a matching rule. The prompt's only close control is Dismiss, which also sets rule_prompt_dismissed_at. That suppresses every rule prompt for the next 24 hours, and nothing tells the user.

Next to a separate "Don't show this again" checkbox, Dismiss reads as "not for this one". A common case: you pick the wrong category, dismiss the prompt, fix the category, and never see the prompt again that day, with no idea why.

Changes

  • Add a close (X) button that removes only this prompt. No request, no snooze. It uses the existing element-removal controller on the toast.
  • Rename "Dismiss" to "Hide for today", with a tooltip: "Hides these rule suggestions for the next 24 hours". The 24h snooze from the original rules engine (#1900) is kept, just stated plainly.
  • Move the prompt's hard-coded strings into config/locales/views/rules/en.yml. Keys inside the render "shared/notifications/cta" do … end block use full paths, because a lazy t(".x") there resolves against the shared partial.

No behaviour change for "Don't show this again".

Tests

New system test category_rule_prompt_test.rb:

  • Closing with X hides that prompt, leaves rule_prompt_dismissed_at nil, and the next category change shows a prompt again.
  • "Hide for today" sets rule_prompt_dismissed_at and doesn't disable prompts.

Related controller tests pass. rubocop and erb_lint are clean, and there are no missing or unused i18n keys.

Related but separate: #1280 / #1281 (a Rules-page toggle for re-enabling prompts after "Don't show this again").

Screenshots

Rendered from test fixtures.

Close (X) in the corner, and the visible 24-hour hint

Close (X) in the corner, and the visible 24-hour hint

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Category rule prompts now display translated messages, descriptions, checkbox and button labels, and links.
    • Prompts include an accessible close button. Closing a prompt leaves future prompts available; choosing “Hide for today” pauses eligible prompts for 24 hours.
    • A translated hint explains the “Hide for today” option.