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:
2026-07-24 22:20:04 +02:00
co-authored by Claude Opus 5
parent ca2aefa156
commit 4acf32ec09
6 changed files with 173 additions and 77 deletions
+2 -2
View File
@@ -46,7 +46,7 @@
</li>
{{{ if support.visible }}}
<li component="support" class="nav-item support dropdown" title="Support inbox">
<li component="support" class="nav-item support dropdown" title="[[westgate:support-inbox.title]]">
<!-- IMPORT partials/header/support-drawer.tpl -->
</li>
{{{ end }}}
@@ -122,7 +122,7 @@
<a href="{relative_path}/unread"><i class="fa fa-fw fa-inbox" aria-hidden="true"></i><span>[[unread:title]]</span><span component="unread/count" class="badge rounded-1 bg-primary {{{ if !unreadCount.topic }}}hidden{{{ end }}}">{unreadCount.topic}</span></a>
<a href="{relative_path}/notifications"><i class="fa fa-fw fa-bell" aria-hidden="true"></i><span>[[global:header.notifications]]</span><span component="notifications/count" class="badge rounded-1 bg-primary {{{ if !unreadCount.notification }}}hidden{{{ end }}}">{unreadCount.notification}</span></a>
{{{ if support.visible }}}
<a href="{relative_path}/support"><i class="fa fa-fw fa-life-ring" aria-hidden="true"></i><span>Support inbox</span><span component="support/count" class="badge rounded-1 bg-primary {{{ if !support.unreadCount }}}hidden{{{ end }}}">{support.unreadCount}</span></a>
<a href="{relative_path}/support"><i class="fa fa-fw fa-life-ring" aria-hidden="true"></i><span>[[westgate:support-inbox.title]]</span><span component="support/count" class="badge rounded-1 bg-primary {{{ if !support.unreadCount }}}hidden{{{ end }}}">{support.unreadCount}</span></a>
{{{ end }}}
{{{ if canChat }}}
<a href="{relative_path}/user/{user.userslug}/chats{{{ if user.lastRoomId }}}/{user.lastRoomId}{{{ end }}}"><i class="fa fa-fw fa-comment" aria-hidden="true"></i><span>[[global:header.chats]]</span><span component="chat/count" class="badge rounded-1 bg-primary {{{ if !unreadCount.chat }}}hidden{{{ end }}}">{unreadCount.chat}</span></a>