feat!: enhance audience filtering and banner validation mechanisms - #48
Open
gormus wants to merge 9 commits into
Open
feat!: enhance audience filtering and banner validation mechanisms#48gormus wants to merge 9 commits into
gormus wants to merge 9 commits into
Conversation
- 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
notification-banners.gjs,notification-banners.gjs). [1] [2]notification-banners.gjs).en.yml). [1] [2]Carousel and banner rendering updates:
notification-banners.gjs).notification-banner.gjs).Code quality and maintainability:
trustHTML(notification-banners.gjs). [1] [2]notification-banner.gjs). [1] [2]Settings migration robustness:
display_ordervalues and providing clear error messages if migration cannot proceed (0002-sort-banners.js).Development tooling:
.commitlintrc.json,.vscode/settings.json). [1] [2]