From 599762739a71ee6b0f3a090db571a47498876a86 Mon Sep 17 00:00:00 2001
From: Pierre Lehnen <55164754+pierre-lehnen-rc@users.noreply.github.com>
Date: Thu, 19 Sep 2024 21:20:48 -0300
Subject: [PATCH] fix: conference calls are shown as "not answered" after they
end (#33179)
---
.changeset/five-coats-rhyme.md | 5 ++++
apps/uikit-playground/package.json | 1 +
apps/uikit-playground/vite.config.ts | 4 +--
.../VideoConferenceBlock.tsx | 25 +++++++++++++------
4 files changed, 26 insertions(+), 9 deletions(-)
create mode 100644 .changeset/five-coats-rhyme.md
diff --git a/.changeset/five-coats-rhyme.md b/.changeset/five-coats-rhyme.md
new file mode 100644
index 000000000000..c5359e3c978a
--- /dev/null
+++ b/.changeset/five-coats-rhyme.md
@@ -0,0 +1,5 @@
+---
+'@rocket.chat/fuselage-ui-kit': patch
+---
+
+Fixed an error that incorrectly showed conference calls as not answered after they ended
diff --git a/apps/uikit-playground/package.json b/apps/uikit-playground/package.json
index 791526c46f9d..4cca93dc00e9 100644
--- a/apps/uikit-playground/package.json
+++ b/apps/uikit-playground/package.json
@@ -15,6 +15,7 @@
"@codemirror/lang-json": "^6.0.1",
"@codemirror/tooltip": "^0.19.16",
"@lezer/highlight": "^1.1.6",
+ "@rocket.chat/core-typings": "workspace:^",
"@rocket.chat/css-in-js": "~0.31.25",
"@rocket.chat/fuselage": "^0.59.0",
"@rocket.chat/fuselage-hooks": "^0.33.1",
diff --git a/apps/uikit-playground/vite.config.ts b/apps/uikit-playground/vite.config.ts
index 61a5ab30e647..4d382d652859 100644
--- a/apps/uikit-playground/vite.config.ts
+++ b/apps/uikit-playground/vite.config.ts
@@ -7,11 +7,11 @@ export default defineConfig(() => ({
esbuild: {},
plugins: [react()],
optimizeDeps: {
- include: ['@rocket.chat/ui-contexts', '@rocket.chat/message-parser'],
+ include: ['@rocket.chat/ui-contexts', '@rocket.chat/message-parser', '@rocket.chat/core-typings'],
},
build: {
commonjsOptions: {
- include: [/ui-contexts/, /message-parser/, /node_modules/],
+ include: [/ui-contexts/, /core-typings/, /message-parser/, /node_modules/],
},
},
}));
diff --git a/packages/fuselage-ui-kit/src/blocks/VideoConferenceBlock/VideoConferenceBlock.tsx b/packages/fuselage-ui-kit/src/blocks/VideoConferenceBlock/VideoConferenceBlock.tsx
index 969ad0af1d7c..7125dbbf1bc4 100644
--- a/packages/fuselage-ui-kit/src/blocks/VideoConferenceBlock/VideoConferenceBlock.tsx
+++ b/packages/fuselage-ui-kit/src/blocks/VideoConferenceBlock/VideoConferenceBlock.tsx
@@ -1,3 +1,4 @@
+import { VideoConferenceStatus } from '@rocket.chat/core-typings';
import {
useGoToRoom,
useTranslation,
@@ -133,9 +134,14 @@ const VideoConferenceBlock = ({
{isUserCaller ? t('Call_again') : t('Call_back')}
-
- {t('Call_was_not_answered')}
-
+ {[
+ VideoConferenceStatus.EXPIRED,
+ VideoConferenceStatus.DECLINED,
+ ].includes(data.status) && (
+
+ {t('Call_was_not_answered')}
+
+ )}
>
)}
{data.type !== 'direct' &&
@@ -151,16 +157,21 @@ const VideoConferenceBlock = ({
>
) : (
-
- {t('Call_was_not_answered')}
-
+ [
+ VideoConferenceStatus.EXPIRED,
+ VideoConferenceStatus.DECLINED,
+ ].includes(data.status) && (
+
+ {t('Call_was_not_answered')}
+
+ )
))}
);
}
- if (data.type === 'direct' && data.status === 0) {
+ if (data.type === 'direct' && data.status === VideoConferenceStatus.CALLING) {
return (