From ad8309b51a86295b62bf753a159322f7f40ecaee Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Mon, 14 Nov 2022 20:54:09 -0800 Subject: [PATCH] properly define page metadata in DM --- package.json | 2 +- .../client/src/components/MkChatPreview.vue | 2 +- .../src/pages/messaging/messaging-room.vue | 20 +++++++++++-------- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 87e4b481d..6621ea6ec 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "calckey", - "version": "12.119.0-calc.13.3", + "version": "12.119.0-calc.13.4", "codename": "aqua", "repository": { "type": "git", diff --git a/packages/client/src/components/MkChatPreview.vue b/packages/client/src/components/MkChatPreview.vue index 4d604e2e8..ff4939905 100644 --- a/packages/client/src/components/MkChatPreview.vue +++ b/packages/client/src/components/MkChatPreview.vue @@ -4,7 +4,7 @@ tabindex="-1" :class="{ isMe: isMe(message), - isRead: message.groupId ? message.reads.includes($i.id) : message.isRead, + isRead: message.groupId ? message.reads.includes($i?.id) : message.isRead, }" :to=" message.groupId diff --git a/packages/client/src/pages/messaging/messaging-room.vue b/packages/client/src/pages/messaging/messaging-room.vue index d3ce5886d..2dbfb5b86 100644 --- a/packages/client/src/pages/messaging/messaging-room.vue +++ b/packages/client/src/pages/messaging/messaging-room.vue @@ -275,6 +275,18 @@ function onVisibilitychange() { onMounted(() => { fetch(); + if (group != null) { + definePageMetadata(computed(() => ({ + title: group.name, + icon: 'ph-chats-teardrop-bold ph-lg', + }))); + } + else { + definePageMetadata(computed(() => ({ + title: user.name, + icon: 'ph-chats-teardrop-bold ph-lg', + }))); + } }); onBeforeUnmount(() => { @@ -282,14 +294,6 @@ onBeforeUnmount(() => { document.removeEventListener('visibilitychange', onVisibilitychange); if (scrollRemove) scrollRemove(); }); - -definePageMetadata(computed(() => !fetching ? user ? { - userName: user, - avatar: user, -} : { - title: group?.name, - icon: 'ph-users-three-bold ph-lg', -} : null));