diff --git a/lib/controllers/reader.js b/lib/controllers/reader.js index b6160fc..668f02d 100644 --- a/lib/controllers/reader.js +++ b/lib/controllers/reader.js @@ -5,6 +5,7 @@ import { getTimelineItems, countUnreadItems } from "../storage/timeline.js"; import { getNotifications, + getDirectConversations, getUnreadNotificationCount, getNotificationCountsByType, markAllNotificationsRead, @@ -138,6 +139,31 @@ export function notificationsController(mountPath) { options.type = tab; } + // CSRF token for action forms + const csrfToken = getToken(request.session); + + // Direct messages tab uses conversation grouping instead of flat list + if (tab === "mention") { + const [conversations, unreadCount, tabCounts] = await Promise.all([ + getDirectConversations(collections), + getUnreadNotificationCount(collections), + getNotificationCountsByType(collections), + ]); + + return response.render("activitypub-notifications", { + title: response.locals.__("activitypub.notifications.title"), + readerParent: { href: `${mountPath}/admin/reader`, text: response.locals.__("activitypub.reader.title") }, + conversations, + items: [], + before: null, + tab, + tabCounts, + unreadCount, + csrfToken, + mountPath, + }); + } + // Get filtered notifications + counts in parallel const [result, unreadCount, tabCounts] = await Promise.all([ getNotifications(collections, options), @@ -145,9 +171,6 @@ export function notificationsController(mountPath) { getNotificationCountsByType(collections), ]); - // CSRF token for action forms - const csrfToken = getToken(request.session); - response.render("activitypub-notifications", { title: response.locals.__("activitypub.notifications.title"), readerParent: { href: `${mountPath}/admin/reader`, text: response.locals.__("activitypub.reader.title") },