feat: Add HeaderNotificationsSlot to enable notifications tray default ON#663
feat: Add HeaderNotificationsSlot to enable notifications tray default ON#663awais-ansari wants to merge 2 commits intoopenedx:masterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #663 +/- ##
==========================================
+ Coverage 72.22% 72.81% +0.59%
==========================================
Files 56 59 +3
Lines 504 515 +11
Branches 108 108
==========================================
+ Hits 364 375 +11
Misses 137 137
Partials 3 3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I'd like to break down the problems listed with the current approach a bit:
I think this part should be a separate PR. I'm not sure if adding a bell to the already very limited space in the mobile header makes sense. It'd be good to get some design/product opinions on this feature.
It is my understanding that this is the main motivation for this change. Overall I agree with this PR's approach as a solution to this.
I understand why this is frustrating, but the overall vision for slots is that they refer to places things can be put, not the default content in those places. I also know that isn't currently the case for quite a few existing slots (including One of the reasons for this is that "where it goes" gives site operators more granular control over how each page/part of a page looks, instead of having one slot change how multiple pages/parts of pages look. With that in mind, I think there's a way to get the best of both worlds here:
const DesktopSecondaryMenuSlot = ({
menu,
}) => (
<PluginSlot
id="org.openedx.frontend.layout.header_desktop_secondary_menu.v1"
idAliases={['desktop_secondary_menu_slot']}
slotOptions={{
mergeProps: true,
}}
>
+ <HeaderNotificationsSlot />
<DesktopHeaderMainOrSecondaryMenu menu={menu} />
</PluginSlot>
);
Hopefully these thoughts/suggestions make sense! Please let me know if you have any questions! |
@brian-smith-tcril Thank you for your detailed review and feedback. I have made the suggested changes. Please review it and let me know. |
brian-smith-tcril
left a comment
There was a problem hiding this comment.
Thank you so much for addressing my previous comments! I'm very happy with this new structure!
I left quite a few comments, but they're pretty much all just README suggestions.
| const LearningHeaderActionsSlot = () => ( | ||
| <PluginSlot | ||
| id="org.openedx.frontend.layout.learning_header_actions.v1" | ||
| idAliases={['learning_header_actions_slot']} |
There was a problem hiding this comment.
This is a new slot so we shouldn't add any aliases
| idAliases={['learning_header_actions_slot']} |
| ### Slot ID Aliases | ||
| * `learning_header_actions_slot` |
There was a problem hiding this comment.
This is a new slot so we shouldn't add any aliases
| ### Slot ID Aliases | |
| * `learning_header_actions_slot` |
| const HeaderNotificationsSlot = () => ( | ||
| <PluginSlot | ||
| id="org.openedx.frontend.layout.header_notifications_tray.v1" | ||
| idAliases={['header_notifications_tray']} |
There was a problem hiding this comment.
This is a new slot so we shouldn't add any aliases
| idAliases={['header_notifications_tray']} |
|
|
||
| ### Disable Notifications in Learning Header Only | ||
|
|
||
| The following `env.config.jsx` will hide the notification bell in the Learning header while keeping it in Desktop and Studio headers: |
There was a problem hiding this comment.
It'd be nice to add some context as to why this is needed as it's not the case for other slots. Explaining that the org.openedx.frontend.layout.header_notifications_tray.v1 slot is rendered in multiple places, so modifying that directly will impact more than just this location, would be good.
| plugins: [ | ||
| { | ||
| op: PLUGIN_OPERATIONS.Hide, | ||
| widgetId: 'header_notifications_tray', |
There was a problem hiding this comment.
| widgetId: 'header_notifications_tray', | |
| widgetId: 'org.openedx.frontend.layout.header_notifications_tray.v1', |
| ## Migration from tutor-contrib-platform-notifications | ||
|
|
||
| Sites currently using `tutor-contrib-platform-notifications` can remove these plugin configurations after upgrading to this version: | ||
|
|
||
| - `org.openedx.frontend.layout.header_desktop_secondary_menu.v1` (notifications insertion) | ||
| - `org.openedx.frontend.layout.studio_header_search_button_slot.v1` (notifications insertion) | ||
| - `org.openedx.frontend.layout.header_learning_help.v1` (notifications insertion) |
There was a problem hiding this comment.
Aren't those being added by tutor-contrib-platform-notifications, so uninstalling/disabling the plugin should remove them?
| - `org.openedx.frontend.layout.studio_header_search_button_slot.v1` (notifications insertion) | ||
| - `org.openedx.frontend.layout.header_learning_help.v1` (notifications insertion) | ||
|
|
||
| Notifications will work out-of-the-box without any plugin configuration. If you want to disable them, follow the examples above. |
There was a problem hiding this comment.
This feels unrelated to the slot.
| plugins: [ | ||
| { | ||
| op: PLUGIN_OPERATIONS.Hide, | ||
| widgetId: 'header_notifications_tray', |
There was a problem hiding this comment.
| widgetId: 'header_notifications_tray', | |
| widgetId: 'org.openedx.frontend.layout.header_notifications_tray.v1', |
| @@ -1,3 +1,3 @@ | |||
| # Desktop Secondary Menu Slot | |||
There was a problem hiding this comment.
It'd be good to update screenshots on this one (and add one for hiding the notification bell)
| @@ -1,3 +1,3 @@ | |||
| # Desktop Secondary Menu Slot | |||
|
|
|||
| ### Slot ID: `org.openedx.frontend.layout.header_desktop_secondary_menu.v1` | |||
There was a problem hiding this comment.
I don't think we need to make a v2 of this slot, but I'd like to see if others have opinions on it.
@arbrandes thoughts?
There was a problem hiding this comment.
I haven't reviewed the changes, but if they implement your suggestion of just modifying default content, then no, we shouldn't need to bump the version, as per FPF ADR 3.




Ticket
Summery
Add a new HeaderNotificationsSlot plugin slot that renders NotificationsTray (from @edx/frontend-plugin-notifications) by default across all 5 header surfaces. This makes notifications available out-of-the-box for every Open edX community instance, while allowing operators to disable them via plugin slot configuration or the existing backend waffle flag.
Motivation
Currently, notifications in the header are enabled through tutor-contrib-platform-notifications, which injects NotificationsTray into 3 separate plugin slots:
Slots
org.openedx.frontend.layout.header_desktop_secondary_menu.v1 (Desktop Header)
org.openedx.frontend.layout.studio_header_search_button_slot.v1 (Studio Header)
org.openedx.frontend.layout.header_learning_help.v1 (Learning Header)
Problems with already implemented tutor-contrib-platform-notifications approach:
Mobile headers are missed entirely. Neither the LMS Mobile Header nor the Studio Mobile Header has notifications, so users on narrow viewports don't see the notification bell.
Not default-on. Community instances must install and configure tutor-contrib-platform-notifications to get notifications. Non-Tutor deployments require manual env.config.jsx configuration.
3 separate slot configs. Operators must configure 3 different slot IDs to enable one feature, and each slot is semantically unrelated to notifications (secondary menu, search button, help link).
Proposal
Create a single new HeaderNotificationsSlot with:
Insert this slot into all 5 header surfaces for authenticated users:
How Operators Can Disable Notifications
Option 1: Plugin slot config (env.config.jsx)
Option 2:
Backend waffle flag - NotificationsTray is self-gating. It returns empty when the backend waffle flag is True. DISABLE_NOTIFICATIONS: True. Backend openedx/openedx-platform#38073