Add Web Push encouragement banner (CIRCLE-40)#110
Merged
HamptonMakes merged 1 commit intoMay 12, 2026
Conversation
Toast-style banner that appears after a signed-in user posts a comment, nudging them to enable browser notifications on this device. Mounts globally in the layout and stays hidden until the comment form fires turbo:submit-end successfully, at which point the controller self-evaluates eligibility and surfaces itself. Eligibility (must all hold): - browser supports Notification + PushManager + a VAPID key is published - permission isn't already 'denied' - not already subscribed on this device - user hasn't dismissed N times (default 3) - user hasn't already enabled via the banner (permanent-off flag) Dismiss/permanent-off state lives in localStorage so it's per-device, matching how subscriptions work. Enabling reuses the existing coplan/web_push module, so no new subscription plumbing. Other entry points listed in the ticket (inbox page, plan-author first view) are deferred — the post-comment trigger is the highest-signal nudge and ships the simplest version of the feature. Generated with Amp
fa46d79 to
30312a0
Compare
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.
Toast-style banner that appears after a signed-in user posts a comment, nudging them to enable browser notifications on this device.
Linear: CIRCLE-40
Stacks on (independent of): #109
Behavior
coplan:web-push-banner:nudgeon a successfulturbo:submit-end.Notification+PushManagerand a VAPID key is publisheddeniedcoplan/web_push.subscribe()module — no new subscription plumbing. Success message replaces the body, banner auto-hides after 4s, never nags again on this device.Files
engine/app/views/coplan/shared/_web_push_banner.html.erb— partial, gated onsigned_in? && CoPlan.configuration.web_push_configured?engine/app/javascript/controllers/coplan/web_push_banner_controller.js— eligibility + enable/dismissengine/app/javascript/controllers/coplan/comment_form_controller.js— dispatches the nudge event on successful submitengine/app/views/layouts/coplan/application.html.erb— renders the partial once globallyDeferred
The ticket also mentions inbox and plan-author triggers; the post-comment trigger is the highest-signal nudge and the simplest first cut. Adding more entry points is additive — they just need to dispatch the same event.
Verification
Generated with Amp