read read notification in front end working

This commit is contained in:
isUnknown 2024-11-17 12:23:28 +01:00
parent fe56312f20
commit 583daa1759
6 changed files with 35 additions and 57 deletions

View file

@ -12,7 +12,10 @@
:comment="comment"
:commentIndex="comments.length - commentIndex"
:key="comment.id"
@click="openedComment = comment"
@click="
readNotification(comment);
openComment(comment);
"
@update:file="changeFile"
@close:comment="closeComment"
/>
@ -244,6 +247,22 @@ function handleCommentPositionClick(event) {
isAddOpen.value = true;
toggleCommentPositionMode(false);
}
function readNotification(comment) {
const correspondingNotification = user.notifications.find(
(notification) => notification.id === comment.id
);
if (correspondingNotification) {
correspondingNotification.isRead = true;
}
}
function openComment(comment) {
if (comment.replies.length) {
openedComment.value = comment;
}
}
</script>
<style>