comments working

This commit is contained in:
isUnknown 2025-01-15 14:18:48 +01:00
parent 375bed1d01
commit 0b472988a2
14 changed files with 107 additions and 59 deletions

View file

@ -11,21 +11,21 @@ export const useUserStore = defineStore("user", () => {
return projects.value.reduce((acc, project) => {
if (!project.notifications) return acc;
const projectNotifications = project.notifications.map(
(notification) => ({
const projectNotifications = project.notifications.map((notification) => {
const newNotification = {
...notification,
target: {
uuid: project.uuid,
title: project.title,
slug: project.slug,
},
isRead:
notification.author.uuid === user.value.uuid ||
notification.readby?.includes(user.value.uuid),
})
project: project,
isRead: notification.readby?.includes(user.value.uuid),
};
return newNotification;
});
const userNotifications = projectNotifications.filter(
(notification) => notification.author.uuid !== user.value.uuid
);
return [...acc, ...projectNotifications];
return [...acc, ...userNotifications];
}, []);
});