From 51a8abb0a211a8b513ab91cf8e2450e5d7a8f0b6 Mon Sep 17 00:00:00 2001 From: svemagie <869694+svemagie@users.noreply.github.com> Date: Fri, 13 Mar 2026 07:26:49 +0100 Subject: [PATCH] feat: use getDirectConversations() for mention tab; pass conversations to template --- lib/controllers/reader.js | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) 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") },