Skip to content

Render every flash key instead of dropping unknown ones - #9161

Open
senid231 wants to merge 1 commit into
activeadmin:masterfrom
senid231:flash-message-keys
Open

senid231 wants to merge 1 commit into
activeadmin:masterfrom
senid231:flash-message-keys

Conversation

@senid231

Copy link
Copy Markdown
Contributor

ActiveAdmin 3 rendered every flash key as div.flash.flash_<type>. The v4 _flash_messages partial only renders error, alert and notice, so any other key, such as flash[:warning], is dropped without a trace. This PR renders every key again.

Motivating case: activeadmin-plugins/active_admin_filter_extensions#9 had to move its :warning flash to :alert and override this partial in its test app to work on v4.

Decisions:

  • The three existing styles are unchanged.
  • warning uses the alert (yellow) style and success uses the notice (green) style, since both names are common in Rails apps.
  • Any other key gets a neutral gray style with the info icon and the same layout.
  • Each message now has data-flash-type="<type>", so tests and themes can target a type without matching Tailwind color classes.
  • flash_messages filtering (flash_keys_to_except, timedout) is untouched.

Verification: new specs in spec/helpers/layout_helper_spec.rb render the partial (they fail without the change); rubocop and typos pass.

@codecov

codecov Bot commented Nov 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.11%. Comparing base (e1dad93) to head (b583d0e).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #9161   +/-   ##
=======================================
  Coverage   99.11%   99.11%           
=======================================
  Files         139      139           
  Lines        4071     4071           
=======================================
  Hits         4035     4035           
  Misses         36       36           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant