From cce158e80afe0168f7e9476d674329ec8ff76e8c Mon Sep 17 00:00:00 2001 From: isUnknown Date: Thu, 19 Dec 2024 11:11:43 +0100 Subject: [PATCH] read notification fully working (content, comment and reply) --- src/components/Menu.vue | 4 ++-- src/components/comments/Comment.vue | 9 +++++---- src/components/notifications/Comment.vue | 2 +- src/components/notifications/Reply.vue | 2 +- src/components/project/ProjectStep.vue | 1 - src/stores/user.js | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/components/Menu.vue b/src/components/Menu.vue index dbe088d..e832597 100644 --- a/src/components/Menu.vue +++ b/src/components/Menu.vue @@ -117,7 +117,7 @@ const { page } = storeToRefs(usePageStore()); const unreadNotificationsCount = computed(() => { if (!user.value) return undefined; const count = user.value.notifications.filter( - (notification) => notification.isread + (notification) => notification.isread != "true" ).length; if (count === 0) return undefined; return count; @@ -164,7 +164,7 @@ function hasUnreadNotification(project) { if (!user.value) return false; return user.value.notifications.some((notification) => { return ( - notification.isread != true && + notification.isread != "true" && project.uri.includes(notification.location.project.uri) ); }); diff --git a/src/components/comments/Comment.vue b/src/components/comments/Comment.vue index e5d485c..4158934 100644 --- a/src/components/comments/Comment.vue +++ b/src/components/comments/Comment.vue @@ -2,7 +2,7 @@
@@ -70,11 +70,11 @@ const api = useApiStore(); const dialog = useDialogStore(); // Functions -const status = computed(() => { +const getStatus = computed(() => { const correspondingNotification = userStore.notifications.find( (notification) => notification.id === comment.id ); - if (correspondingNotification && !correspondingNotification.isread) { + if (correspondingNotification && correspondingNotification.isread != "true") { return "unread"; } return undefined; @@ -101,9 +101,10 @@ function closeAddField() { } async function read() { - if (status.value !== "unread") return; + if (getStatus.value !== "unread") return; try { const newNotification = await api.readNotification(comment.id); + console.log(newNotification); userStore.readNotification(comment.id); } catch (error) { console.log("Erreur lors de la lecture de la notification : ", error); diff --git a/src/components/notifications/Comment.vue b/src/components/notifications/Comment.vue index 31cfc42..3e66618 100644 --- a/src/components/notifications/Comment.vue +++ b/src/components/notifications/Comment.vue @@ -1,7 +1,7 @@