read notification fully working (content, comment and reply)
This commit is contained in:
parent
51409bd090
commit
cce158e80a
6 changed files with 10 additions and 10 deletions
|
|
@ -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)
|
||||
);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<article
|
||||
:id="`comment-${comment.id}`"
|
||||
class="comment | flow"
|
||||
:data-status="status"
|
||||
:data-status="getStatus"
|
||||
@click="read()"
|
||||
>
|
||||
<header>
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<article
|
||||
class="notification | bg-white rounded-lg | p-16 | flow"
|
||||
:data-status="notification.isread == true ? 'read' : 'unread'"
|
||||
:data-status="notification.isread == 'true' ? 'read' : 'unread'"
|
||||
data-type="comment"
|
||||
@click="router.push(notification.location.dialoguri + '&comments=true')"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<article
|
||||
class="notification | bg-white rounded-lg | p-16 | flow"
|
||||
:data-status="notification.isread == true ? 'read' : 'unread'"
|
||||
:data-status="notification.isread == 'true' ? 'read' : 'unread'"
|
||||
data-type="comment"
|
||||
@click="router.push(notification.location.dialoguri + '&comments=true')"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -223,7 +223,6 @@ function getFrontView(track) {
|
|||
const extension = track.files[0].name.split(".")[1];
|
||||
const frontViewName = "0_" + xFrontView + "." + extension;
|
||||
const frontView = track.files.find((file) => file.name === frontViewName);
|
||||
console.log(frontView);
|
||||
return frontView;
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ export const useUserStore = defineStore("user", () => {
|
|||
function readNotification(notificationId) {
|
||||
user.value.notifications.forEach((notification) => {
|
||||
if (notification.id === notificationId) {
|
||||
notification.isread = true;
|
||||
notification.isread = "true";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue