feat: allow disabling and dismissing the open source message banner#15089
Open
devGregA wants to merge 3 commits into
Open
feat: allow disabling and dismissing the open source message banner#15089devGregA wants to merge 3 commits into
devGregA wants to merge 3 commits into
Conversation
…r the OS promo banner DD_OS_MESSAGE_ENABLED (bool, default True) is a global admin opt-out: when False, get_os_banner() returns None before any network call, so no request is made to the GCS bucket. Default behavior is unchanged. Authenticated users can also dismiss the banner via a close (x) button. The dismissal is stored as a hash of the current message on UserContactInfo (mirroring the ui_use_tailwind preference), so the banner reappears only when the promo text changes. The button posts to a new dismiss_os_message endpoint (form-based CSRF) and hides the banner instantly via JS, degrading to a normal POST when JS is disabled. Includes migration 0270, docs and template-env updates, and unit tests (36 passing in unittests/test_os_message.py). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…utton Moves the dismiss (x) to lead the banner, before the headline, so it is clearly separated from the expand caret and avoids misclicks. Replaces the reused Bootstrap '.close' class (which collided with auto-generated v3 UI styles) with a dedicated 'os-message-dismiss' class styled as a small bordered button. Lays out the OS banner as a centered flex row scoped to [data-source="os"], so the styling applies only to this banner; other banners and the messages notifications are unaffected. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Author
|
@DryRunSecurity fp drs_d57257ef This isn't user input. |
Contributor
Author
|
@DryRunSecurity fp drs_f11c06a6 Same deal, this is the classic-UI copy of that same line. |
|
Finding d57257ef has been successfully dismissed and marked as False Positive. |
|
Finding f11c06a6 has been successfully dismissed and marked as False Positive. |
…URE_LOCATIONS TestDismissOsMessageView loaded dojo_testdata.json directly, which raises NotImplementedError under V3_FEATURE_LOCATIONS=True (the fixture contains deprecated Endpoint records). Adding the @versioned_fixtures decorator swaps it to dojo_testdata_locations.json under V3, matching the convention used by the rest of the suite. Test-only change; verified passing locally under both V3=True and V3=False. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
The open source message banner (the "Upgrade to Pro" promo fetched from the
GCS bucket) currently can't be turned off. This adds two ways to do that.
DD_OS_MESSAGE_ENABLED(defaultTrue) — an instance-wide switch.When it's off,
get_os_banner()returns early, so we don't fetch themessage or render the banner at all.
A dismiss (×) button on the banner. Dismissing it is remembered per user
by storing a hash of the current message on
UserContactInfo. If themessage later changes, the hash no longer matches and the banner shows
again. This follows the same pattern as the existing announcement
dismissal, minus the confirmation page.
Default behavior is unchanged: leave the env var unset and don't click ×,
and the banner behaves exactly as it does today.
Notes:
os_message_dismissed_hashfield onUserContactInfo(migration 0270).dismiss_os_messageview (CSRF handled by the form);JS hides the banner immediately and falls back to a normal POST if JS is off.
Handled in both the classic and v3 base templates.
template-envupdated and a note added to the 3.1 upgrade page.Testing: extended
unittests/test_os_message.py(env gate, dismiss-token,context-processor gating, and the dismiss view). All passing locally.