feat: use getDirectConversations() for mention tab; pass conversations to template
This commit is contained in:
@@ -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") },
|
||||
|
||||
Reference in New Issue
Block a user