From 375bed1d016dc8700c76a7dd7fb88be85e571419 Mon Sep 17 00:00:00 2001 From: isUnknown Date: Fri, 10 Jan 2025 18:17:13 +0100 Subject: [PATCH] comment notification : dynamize target uri --- public/site/templates/projects.json.php | 3 ++- src/components/notifications/Comment.vue | 6 +++++- src/stores/user.js | 7 ++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/public/site/templates/projects.json.php b/public/site/templates/projects.json.php index c87efaa..fe80916 100644 --- a/public/site/templates/projects.json.php +++ b/public/site/templates/projects.json.php @@ -10,7 +10,8 @@ function getProjectData($project) { "logo" => $project->client()->toPage() ? $project->client()->toPage()->logo()->toFile()->url() : "", "steps" => $project->getSteps(), "notifications" => Yaml::decode($project->notifications()->value), - "uuid" => (string) $project->uuid() + "uuid" => (string) $project->uuid(), + "slug" => (string) $project->slug(), ]; } diff --git a/src/components/notifications/Comment.vue b/src/components/notifications/Comment.vue index 1b874f5..19193f0 100644 --- a/src/components/notifications/Comment.vue +++ b/src/components/notifications/Comment.vue @@ -2,7 +2,7 @@

@@ -47,4 +47,8 @@ const { formatDate } = useNotificationsStore(); const { getProjectByUuid } = useProjectsStore(); const project = getProjectByUuid(notification.location.project.uuid); +const targetUri = notification.location.dialoguri.replace( + /\/projects\/([a-z0-9\-]+)/, + "/projects/" + notification.target.slug +); diff --git a/src/stores/user.js b/src/stores/user.js index c503dd9..cee874d 100644 --- a/src/stores/user.js +++ b/src/stores/user.js @@ -14,9 +14,10 @@ export const useUserStore = defineStore("user", () => { const projectNotifications = project.notifications.map( (notification) => ({ ...notification, - project: { - id: project.id, - name: project.title, + target: { + uuid: project.uuid, + title: project.title, + slug: project.slug, }, isRead: notification.author.uuid === user.value.uuid ||