From af30d3cd8cba2a83c896507f3552cf22edd56d54 Mon Sep 17 00:00:00 2001 From: Kristaps Fabians Geikins Date: Thu, 15 Feb 2024 11:55:12 +0200 Subject: [PATCH] fix(fe2): user activity tracking --- packages/frontend-2/lib/viewer/composables/activity.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/frontend-2/lib/viewer/composables/activity.ts b/packages/frontend-2/lib/viewer/composables/activity.ts index 2901357af3..06ff886335 100644 --- a/packages/frontend-2/lib/viewer/composables/activity.ts +++ b/packages/frontend-2/lib/viewer/composables/activity.ts @@ -82,7 +82,7 @@ export function useViewerUserActivityBroadcasting( const { isEnabled: isEmbedEnabled } = useEmbed() const invokeMutation = async (message: ViewerUserActivityMessageInput) => { - if (!isLoggedIn.value || isEmbedEnabled) return false + if (!isLoggedIn.value || isEmbedEnabled.value) return false const result = await apollo .mutate({ mutation: broadcastViewerUserActivityMutation, @@ -176,7 +176,7 @@ export function useViewerUserActivityTracking(params: { const incomingSessionId = event.sessionId if (sessionId.value === incomingSessionId) return - if (!isEmbedEnabled && status === ViewerUserActivityStatus.Disconnected) { + if (!isEmbedEnabled.value && status === ViewerUserActivityStatus.Disconnected) { triggerNotification({ description: `${users.value[incomingSessionId]?.userName || 'A user'} left.`, type: ToastNotificationType.Info @@ -208,7 +208,10 @@ export function useViewerUserActivityTracking(params: { lastUpdate: dayjs() } - if (!isEmbedEnabled && !Object.keys(users.value).includes(incomingSessionId)) { + if ( + !isEmbedEnabled.value && + !Object.keys(users.value).includes(incomingSessionId) + ) { triggerNotification({ description: `${userData.userName} joined.`, type: ToastNotificationType.Info