Skip to content

feat!: enhance audience filtering and banner validation mechanisms - #48

Open
gormus wants to merge 9 commits into
mainfrom
feat/20260718
Open

feat!: enhance audience filtering and banner validation mechanisms#48
gormus wants to merge 9 commits into
mainfrom
feat/20260718

Conversation

@gormus

@gormus gormus commented Jul 26, 2026

Copy link
Copy Markdown
Owner

This pull request introduces several improvements and refactors to the notification banners feature, focusing on audience targeting, code maintainability, carousel behavior, and user experience. The changes streamline group matching logic, enhance banner filtering, improve carousel initialization, and update documentation for clarity.

Audience targeting and filtering improvements:

  • Refactored group matching logic: Group-based audience filtering now happens in the initializer, with improved logic for determining which banners a user should see, including better handling of trust level and anonymous groups (notification-banners.gjs, notification-banners.gjs). [1] [2]
  • Removed redundant audience matching in the component, centralizing filtering and reducing duplication (notification-banners.gjs).
  • Updated English locale documentation to clarify group selection for banner audiences and plugin outlet descriptions (en.yml). [1] [2]

Carousel and banner rendering updates:

  • Moved Splide carousel initialization to a dedicated modifier for better lifecycle management and to ensure carousels are properly mounted/unmounted as banners change (notification-banners.gjs).
  • Improved handling of dismissible banners to avoid localStorage errors and ensure banners in carousels are not dismissible (notification-banner.gjs).

Code quality and maintainability:

  • Improved color style caching with normalization, cache size limits, and safer style handling using trustHTML (notification-banners.gjs). [1] [2]
  • Updated imports to use UI Kit components and improved code safety and clarity in the notification banner component (notification-banner.gjs). [1] [2]

Settings migration robustness:

  • Strengthened the banners migration script by validating display_order values and providing clear error messages if migration cannot proceed (0002-sort-banners.js).

Development tooling:

  • Added a commitlint rule to allow unlimited commit body line length and disabled Biome validation in VSCode settings for stylesheets (.commitlintrc.json, .vscode/settings.json). [1] [2]

gormus added 9 commits July 19, 2026 17:35
- Filter banners by enabled_groups in the API initializer before rendering, including trust_level auto-groups for correct matching
- Add inCarousel prop to NotificationBanner to suppress dismiss buttons inside carousels
- Guard bannerStyles() against invalid hex colors and provide graceful fallbacks
- Fail closed for non-finite date_after / date_before values
- Validate splide options strings at initialization time
- Guard localStorage reads/writes against private browsing mode
- Evict oldest entries when the color cache exceeds 50 items
- Add min_length:6 validation to background_color setting schema
- Add input validation to banner migrations (display_order, outlet)
- Expand locale descriptions for plugin_outlet and dismissible
- Add system specs for anonymous users, group targeting, route changes, invalid colors, invalid dates, and combined filters
Remove explicit `type: :system` from RSpec.describe blocks, relying on Discourse's default system test configuration. Replace inline `Fabricate` calls in `fab!` helpers with shorthand symbol syntax (`:user`, `:category`).

These declarations are redundant and add verbosity without changing test behavior.
Move fab! declarations out of before blocks for cleaner setup in the group targeting tests. Rename the 'invalid date bounds' context to 'out-of-range date bounds' since the test now uses valid date formats (future/past dates) instead of malformed strings, and update all associated banner titles and assertions to match.
- Shorten theme_authorized_extensions to only js|css in both specs
- Use Fabrikate shorthand syntax (fab!:name, :type) in group targeting spec
- Remove redundant Fabricate arguments in notification_banners_spec
Update dev dependencies: eslint 10.7→10.8, prettier 3.9.5→3.9.6,
stylelint 17.14.0→17.14.1, lint-staged 17.0.8→17.3.0,
@glint/ember-tsc 1.8.12→1.8.14, @types/node ^26.1.1→^26.1.2,
concurrently ^10.0.3→^10.0.4, discourse types
2026.7.0→2026.8.0.

Remove .template-lintrc.cjs which is no longer needed.

Update CI workflows: increase d-compat sync schedule from daily to
every 6 hours and trigger on main pushes. Remove core_ref: stable
override from theme CI.
Removes min_length: 6 from the background_color field validations.
With max_length: 6 already in place, the min_length constraint
is redundant and unnecessarily restricts the field for banners
that may not need a custom color.
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