read comment notification working
This commit is contained in:
parent
9222069ef5
commit
246d21f85a
17 changed files with 86 additions and 111 deletions
|
|
@ -115,15 +115,15 @@ import { useProjectStore } from "../stores/project";
|
|||
|
||||
const route = useRoute();
|
||||
const isExpanded = ref(true);
|
||||
const { user } = storeToRefs(useUserStore());
|
||||
const { user, notifications } = storeToRefs(useUserStore());
|
||||
const { currentProjects, archivedProjects } = storeToRefs(useProjectsStore());
|
||||
const { isEmptyBrief } = useProjectStore();
|
||||
const { page } = storeToRefs(usePageStore());
|
||||
|
||||
const unreadNotificationsCount = computed(() => {
|
||||
if (!user.value) return undefined;
|
||||
const count = user.value.notifications.filter(
|
||||
(notification) => notification.isread != "true"
|
||||
const count = notifications.value.filter(
|
||||
(notification) => !notification.isRead
|
||||
).length;
|
||||
if (count === 0) return undefined;
|
||||
return count;
|
||||
|
|
@ -168,7 +168,7 @@ function isCurrent(navItem) {
|
|||
|
||||
function hasUnreadNotification(project) {
|
||||
if (!user.value) return false;
|
||||
return user.value.notifications.some((notification) => {
|
||||
return notifications.value.some((notification) => {
|
||||
return (
|
||||
notification.isread != "true" &&
|
||||
project.uri.includes(notification.location.project.uri)
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ const getStatus = computed(() => {
|
|||
const correspondingNotification = userStore.notifications.find(
|
||||
(notification) => notification.id === comment.id
|
||||
);
|
||||
if (correspondingNotification && correspondingNotification.isread != "true") {
|
||||
if (correspondingNotification && !correspondingNotification.isRead) {
|
||||
return "unread";
|
||||
}
|
||||
return undefined;
|
||||
|
|
@ -143,7 +143,7 @@ function handleClick() {
|
|||
async function read() {
|
||||
if (getStatus.value !== "unread") return;
|
||||
try {
|
||||
const newNotification = await api.readNotification(comment.id);
|
||||
const newNotification = await api.readNotification(comment);
|
||||
console.log(newNotification);
|
||||
userStore.readNotification(comment.id);
|
||||
} catch (error) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
<template>
|
||||
<article
|
||||
class="notification | bg-white rounded-lg | p-16 | flow"
|
||||
:data-status="notification.isread == 'true' ? 'read' : 'unread'"
|
||||
data-type="comment"
|
||||
@click="router.push(notification.location.dialoguri + '&comments=true')"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
<template>
|
||||
<article
|
||||
class="notification | bg-white rounded-lg | p-16 | flow"
|
||||
:data-status="notification.isread == 'true' ? 'read' : 'unread'"
|
||||
data-type="content"
|
||||
@click="
|
||||
read(notification);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
<template>
|
||||
<article
|
||||
class="notification | bg-white rounded-lg | p-16 | flow"
|
||||
:data-status="notification.isread == 'true' ? 'read' : 'unread'"
|
||||
data-type="comment"
|
||||
@click="router.push(notification.location.dialoguri + '&comments=true')"
|
||||
>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue