-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: add notification warning alert to Tasks page #20900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add notification warning alert to Tasks page #20900
Conversation
104c727 to
57f4afc
Compare
57f4afc to
322c8e9
Compare
aslilac
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think localStorage is the right way to store the dismissal state here. I think this would be a very good candidate for storing in the user_configs table. You could follow the plumbing for theme_preference for 90% of the implementation, and then the preference would persist across machines and any potential storage clearing a browser or operating system might do.
@aslilac Thank you for the review! Since this is more of a transient “don’t show this again” UI state rather than a real user preference, |
but that's my point. if we don't persist this state somewhere centrally it's not "one-time". and it is a user preference: a preference to not be notified about this again. your current implementation doesn't store the preference for a specific user, it stores it for a specific browser. if you logged in with a different account it would still be dismissed. it's not a "front-end" concern, it is a state concern. |
Add comprehensive documentation for active frontend pattern migrations discovered through analysis of 200+ git commits touching site/ files: Core Migrations: - Emotion → Tailwind CSS (strict 'no new emotion' policy) - MUI Components → Custom/Radix/shadcn (Tooltips, Tables, Buttons) - MUI Icons → lucide-react with specific icon mappings - spyOn → queries parameter for GET endpoint mocks in Storybook - localStorage → user_configs table for user preferences New Documentation: - Icon migration mappings (BusinessIcon→Building2Icon, etc.) - Radix component prop naming conventions (placement→side) - cn() utility usage for conditional className merging - Chromatic testing best practices (prefer snapshots over assertions) Includes concrete before/after examples and migration patterns to guide developers away from deprecated approaches toward current best practices. Analysis based on PRs: #20948, #20946, #20938, #20905, #20900, #20869, #20849, #20808, #20530, #20479, #20261, #20201, #20200, #20193, #20318 --- 🤖 This change was written by Claude Sonnet 4.5 Thinking using mux and reviewed by a human 🏂
That makes sense 🙂 I was thinking in terms of the user persona I assumed for Coder UI (generally using a single browser, rarely clearing storage, and not sharing that browser with others), so But I understand your point about this being a true user preference rather than browser-local state, and how storing it centrally avoids the cross-browser and cross-account inconsistencies you mentioned. I’ll update the PR to persist the dismissal in |
…e-tasks-notifications-disabled
…e-tasks-notifications-disabled
…e-tasks-notifications-disabled
mafredri
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small suggestions for BE but looks good otherwise 👍🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy with what we have. Left a non-blocking nit and left a 👍 emoji on @mafredri's comments that I agree with
…e-tasks-notifications-disabled
mafredri
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last (minor) comment on the backend implementation, I'll submit this now and start looking at the FE changes.
mafredri
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had some minor comments, but FE looks good to me. 👍🏻
| }; | ||
|
|
||
| export function isTaskNotification(tmpl: NotificationTemplate): boolean { | ||
| return tmpl.group === "Task Events"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Side-note: It would be nice if we had real enums for these.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we are missing enums in the FE for a lot of things.
| updatePreferencesMutation.mutate({ | ||
| task_notification_alert_dismissed: false, | ||
| }); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine for now, but should we consider doing this on the backend? Ideally this change would be propagated even if done directly via API or UI (or CLI if we support that, or will support that in the future).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I also thought about that and that might be a better approach. I will address that in a follow-up PR.
Problem
Users may not realize that task notifications are disabled by default. To improve awareness, we show a warning alert on the Tasks page when all task notifications are disabled.
Alert visibility logic:
Changes
/users/{user}/preferencesendpoint to manage user preferences (stored inuser_configstable)Closes: coder/internal#1089