Make the support drawer core's notification drawer (sow-nodebb-plugin-support#10)
The first version of this drawer built its own rows in JS. This one renders core's `partials/notifications_list` partial with entries the support plugin now returns in core's notification shape, so the markup is literally the notification drawer's: avatar block, stretched link, muted timeago, per-entry read dot, All/Unread filter row, and the same two footer buttons. The handlers mirror core's too — only the API paths differ, because the list is plugin-owned (core's unread count is one aggregate with no hook to carve a type out of it). Opening the box no longer marks everything read: like the bell, an entry is read when you click it or use "Mark all read", and the dot toggles both ways. Deletes the bespoke row builder and its hand-rolled relative-time helper; `$.timeago` is what core uses for JS-inserted rows. The dropdown reuses the `.notifications-dropdown` class this theme already styles, so it needs no CSS of its own. Hardcoded English is gone (the code-review finding on the first version): every string is a translation key. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -203,9 +203,31 @@ assertIncludes(
|
||||
);
|
||||
assertIncludes(
|
||||
supportDrawer,
|
||||
'data-wg-support-menu',
|
||||
'component="support/list"',
|
||||
'Support dropdown menu should expose the JS mount hook'
|
||||
);
|
||||
assertIncludes(
|
||||
supportDrawer,
|
||||
'notifications-dropdown',
|
||||
'Support drawer should reuse Harmony\'s notification dropdown styling, not a bespoke class'
|
||||
);
|
||||
assertIncludes(
|
||||
supportDrawer,
|
||||
'notification-list',
|
||||
'Support inbox list should reuse Harmony\'s own notification-list styling, not a bespoke class'
|
||||
);
|
||||
['data-filter="unread"', 'mark-all-read', 'mark-read'].forEach((marker) => {
|
||||
assertIncludes(
|
||||
supportDrawer,
|
||||
marker,
|
||||
`Support drawer should offer the same controls as the notification drawer (${marker})`
|
||||
);
|
||||
});
|
||||
assertIncludes(
|
||||
supportDrawer,
|
||||
'[[westgate:support-inbox.title]]',
|
||||
'Support inbox strings should be translation keys, matching every other topbar item'
|
||||
);
|
||||
assertMatches(
|
||||
topbar,
|
||||
/href="\{relative_path\}\/support"[^>]*>[\s\S]*?component="support\/count"/,
|
||||
@@ -213,6 +235,6 @@ assertMatches(
|
||||
);
|
||||
assertIncludes(
|
||||
stylesheet,
|
||||
'.support-dropdown',
|
||||
'Topbar styles should cover the support inbox dropdown'
|
||||
'.wg-topbar .notifications-dropdown',
|
||||
'Topbar styles should cover the notification-style dropdowns the support inbox reuses'
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user