From f1f4596943f3a431cbd1101be30a62cbf1b019f5 Mon Sep 17 00:00:00 2001 From: Hugo Costa Date: Thu, 19 May 2022 15:59:09 -0300 Subject: [PATCH 1/6] fix: Click to join button Jitsi Call --- .../app/action-links/client/lib/actionLinks.ts | 2 +- apps/meteor/app/videobridge/client/actionLink.js | 13 +++++++++++-- .../MessageList/providers/MessageListProvider.tsx | 15 +++++++++++++-- .../views/room/providers/MessageProvider.tsx | 6 ++++-- yarn.lock | 8 ++++---- 5 files changed, 33 insertions(+), 11 deletions(-) diff --git a/apps/meteor/app/action-links/client/lib/actionLinks.ts b/apps/meteor/app/action-links/client/lib/actionLinks.ts index 359eb88adfec..42c0a493d366 100644 --- a/apps/meteor/app/action-links/client/lib/actionLinks.ts +++ b/apps/meteor/app/action-links/client/lib/actionLinks.ts @@ -42,7 +42,7 @@ export const actionLinks = { // return message; // }, - run(method: string, message: IMessage, instance: undefined): void { + run(method: string, message: IMessage, instance: undefined | Function): void { const actionLink = message.actionLinks && message.actionLinks.find((action) => action.method_id === method); if (!actionLink) { diff --git a/apps/meteor/app/videobridge/client/actionLink.js b/apps/meteor/app/videobridge/client/actionLink.js index 817e5ad32795..e99981c072eb 100644 --- a/apps/meteor/app/videobridge/client/actionLink.js +++ b/apps/meteor/app/videobridge/client/actionLink.js @@ -34,7 +34,12 @@ actionLinks.register('joinJitsiCall', function (message, params, instance) { }); if (jitsiTimeout > clickTime) { - instance.tabBar.open('video'); + if (instance instanceof Function) { + instance('video'); + } else { + instance.tabBar.open('video'); + } + return; } @@ -50,7 +55,11 @@ actionLinks.register('joinJitsiCall', function (message, params, instance) { } if (result?.jitsiTimeout && result.jitsiTimeout instanceof Date && result.jitsiTimeout > clickTime) { - instance.tabBar.open('video'); + if (instance instanceof Function) { + instance('video'); + } else { + instance.tabBar.open('video'); + } return; } diff --git a/apps/meteor/client/views/room/MessageList/providers/MessageListProvider.tsx b/apps/meteor/client/views/room/MessageList/providers/MessageListProvider.tsx index 5d8011fe921b..b711e492b969 100644 --- a/apps/meteor/client/views/room/MessageList/providers/MessageListProvider.tsx +++ b/apps/meteor/client/views/room/MessageList/providers/MessageListProvider.tsx @@ -1,9 +1,10 @@ import { IRoom, IMessage, isTranslatedMessage, isMessageReactionsNormalized } from '@rocket.chat/core-typings'; -import { useLayout, useUser, useUserPreference, useUserSubscription, useSetting, useEndpoint } from '@rocket.chat/ui-contexts'; +import { useLayout, useUser, useUserPreference, useUserSubscription, useSetting, useEndpoint, useUserRoom } from '@rocket.chat/ui-contexts'; import React, { useMemo, FC, memo } from 'react'; import { EmojiPicker } from '../../../../../app/emoji/client'; import { getRegexHighlight, getRegexHighlightUrl } from '../../../../../app/highlight-words/client/helper'; +import ToolboxProvider from '../../providers/ToolboxProvider'; import { MessageListContext, MessageListContextValue } from '../contexts/MessageListContext'; import { useAutotranslateLanguage } from '../hooks/useAutotranslateLanguage'; @@ -132,5 +133,15 @@ export const MessageListProvider: FC<{ ], ); - return ; + const room = useUserRoom(rid); + + if (!room) { + throw new Error('Room not found'); + } + + return ( + + + + ); }); diff --git a/apps/meteor/client/views/room/providers/MessageProvider.tsx b/apps/meteor/client/views/room/providers/MessageProvider.tsx index 264e2066b8d6..95b60ceaff33 100644 --- a/apps/meteor/client/views/room/providers/MessageProvider.tsx +++ b/apps/meteor/client/views/room/providers/MessageProvider.tsx @@ -10,6 +10,7 @@ import { roomCoordinator } from '../../../lib/rooms/roomCoordinator'; import { fireGlobalEvent } from '../../../lib/utils/fireGlobalEvent'; import { goToRoomById } from '../../../lib/utils/goToRoomById'; import { MessageContext } from '../contexts/MessageContext'; +import { useTabBarOpen } from './ToolboxProvider'; export const MessageProvider = memo(function MessageProvider({ rid, @@ -20,6 +21,7 @@ export const MessageProvider = memo(function MessageProvider({ broadcast?: boolean; children: ReactNode; }) { + const tabBarOpen = useTabBarOpen(); const [routeName, params, queryStringParams] = useCurrentRoute(); const { isEmbedded, isMobile } = useLayout(); const oembedEnabled = Boolean(useSetting('API_Embed')); @@ -73,7 +75,7 @@ export const MessageProvider = memo(function MessageProvider({ message: msg, }) : (msg: IMessage) => (actionLink: string) => (): void => { - actionLinks.run(actionLink, msg, undefined); + actionLinks.run(actionLink, msg, tabBarOpen); }; return { oembedEnabled, @@ -112,7 +114,7 @@ export const MessageProvider = memo(function MessageProvider({ dateAndTime, }, }; - }, [isEmbedded, oembedEnabled, isMobile, broadcast, time, dateAndTime, router, params, rid, routeName, queryStringParams]); + }, [isEmbedded, oembedEnabled, isMobile, broadcast, time, dateAndTime, router, params, rid, routeName, tabBarOpen, queryStringParams]); return {children}; }); diff --git a/yarn.lock b/yarn.lock index 9f2987fbf207..328d48c019b4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7900,7 +7900,7 @@ __metadata: human-interval: ~1.0.0 moment-timezone: ~0.5.27 mongodb: ~3.5.0 - checksum: f5f68008298f9482631f1f494e392cd6b8ba7971a3b0ece81ae2abe60f53d67973ff4476156fa5c9c41b8b58c4ccd284e95c545e0523996dfd05f9a80b843e07 + checksum: 52010c15379ff6985f91f659db8ccd65b44b2986b46b2a64ca8890657635cc5875154e911ec0eb2e5d188faf576036c951cd9c117fa41261686c4e1d6e27e162 languageName: node linkType: hard @@ -10509,7 +10509,7 @@ __metadata: resolution: "cas@https://github.com/kcbanner/node-cas.git#commit=fcd27dad333223b3b75a048bce27973fb3ca0f62" dependencies: cheerio: 0.19.0 - checksum: 3db182211097cb567d1d7331b03d0fb9ab78467d45158df3da869152dcebcb8c226a0cad18037bddcf5367fc80e1f5e575b66ee53c4e7a68e03e3bd48b65d91b + checksum: e43003b4dcf076f5a41e399cc66edf575ddd10f6cffaa95ed6839f5b71efccd7de716b259319dfca0354bfa5c4c28539e54735095becb356bfab2e28ea236c5e languageName: node linkType: hard @@ -21015,7 +21015,7 @@ __metadata: resolution: "lamejs@https://github.com/zhuker/lamejs.git#commit=582bbba6a12f981b984d8fb9e1874499fed85675" dependencies: use-strict: 1.0.1 - checksum: fa829e0c170a65573e653b4d908a44aaf06a50e1bbade3b1217a300a03ccd59a537e294e2d924a584f9d70c7726a12d4c3af9c675436d48d08be5fb94b5eb400 + checksum: ed7f6f1c9629b53c17023eb04b4fc5a222e9c34fcb4a2f61214488fc64e5cfea825e4588d959c5fb20f3a91f0120103fa60307dd43df995d498ff5ddb6200cd9 languageName: node linkType: hard @@ -21153,7 +21153,7 @@ __metadata: optional: true bin: lessc: ./bin/lessc - checksum: 61568b56b5289fdcfe3d51baf3c13e7db7140022c0a37ef0ae343169f0de927a4b4f4272bc10c20101796e8ee79e934e024051321bba93b3ae071f734309bd98 + checksum: c9646e8377f8ce59648891ecdb7ebf1aea23349d145cc2f7d192785b8ede1677eb2582aa991175dcf18a63a092f81a1d3f8554a2826493f94d6db82b6007f409 languageName: node linkType: hard From dbd0cbb30b5bbe72f78b64f8c13a0abb21f55aff Mon Sep 17 00:00:00 2001 From: Tasso Evangelista Date: Mon, 23 May 2022 10:31:32 -0300 Subject: [PATCH 2/6] Fix `yarn` references --- yarn.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/yarn.lock b/yarn.lock index 77c337d1972e..6bcc18a66a4d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7973,7 +7973,7 @@ __metadata: human-interval: ~1.0.0 moment-timezone: ~0.5.27 mongodb: ~3.5.0 - checksum: 52010c15379ff6985f91f659db8ccd65b44b2986b46b2a64ca8890657635cc5875154e911ec0eb2e5d188faf576036c951cd9c117fa41261686c4e1d6e27e162 + checksum: acb4ebb7e7356f6e53e810d821eb6aa3d88bbfb9e85183e707517bee6d1eea1f189f38bdf0dd2b91360492ab7643134d510c320d2523d86596498ab98e59735b languageName: node linkType: hard @@ -10582,7 +10582,7 @@ __metadata: resolution: "cas@https://github.com/kcbanner/node-cas.git#commit=fcd27dad333223b3b75a048bce27973fb3ca0f62" dependencies: cheerio: 0.19.0 - checksum: e43003b4dcf076f5a41e399cc66edf575ddd10f6cffaa95ed6839f5b71efccd7de716b259319dfca0354bfa5c4c28539e54735095becb356bfab2e28ea236c5e + checksum: 3db182211097cb567d1d7331b03d0fb9ab78467d45158df3da869152dcebcb8c226a0cad18037bddcf5367fc80e1f5e575b66ee53c4e7a68e03e3bd48b65d91b languageName: node linkType: hard @@ -21088,7 +21088,7 @@ __metadata: resolution: "lamejs@https://github.com/zhuker/lamejs.git#commit=582bbba6a12f981b984d8fb9e1874499fed85675" dependencies: use-strict: 1.0.1 - checksum: ed7f6f1c9629b53c17023eb04b4fc5a222e9c34fcb4a2f61214488fc64e5cfea825e4588d959c5fb20f3a91f0120103fa60307dd43df995d498ff5ddb6200cd9 + checksum: fa829e0c170a65573e653b4d908a44aaf06a50e1bbade3b1217a300a03ccd59a537e294e2d924a584f9d70c7726a12d4c3af9c675436d48d08be5fb94b5eb400 languageName: node linkType: hard @@ -21226,7 +21226,7 @@ __metadata: optional: true bin: lessc: ./bin/lessc - checksum: c9646e8377f8ce59648891ecdb7ebf1aea23349d145cc2f7d192785b8ede1677eb2582aa991175dcf18a63a092f81a1d3f8554a2826493f94d6db82b6007f409 + checksum: 61568b56b5289fdcfe3d51baf3c13e7db7140022c0a37ef0ae343169f0de927a4b4f4272bc10c20101796e8ee79e934e024051321bba93b3ae071f734309bd98 languageName: node linkType: hard From a8ac3e8c6936fea72d79a7f3129689b3b4fb4a0b Mon Sep 17 00:00:00 2001 From: Hugo Costa Date: Tue, 24 May 2022 07:57:20 -0300 Subject: [PATCH 3/6] fix: Old message Jitsi Button --- apps/meteor/app/ui-utils/client/lib/messageContext.js | 4 ++-- yarn.lock | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/meteor/app/ui-utils/client/lib/messageContext.js b/apps/meteor/app/ui-utils/client/lib/messageContext.js index 7a1d4b73a0e9..878199c11de1 100644 --- a/apps/meteor/app/ui-utils/client/lib/messageContext.js +++ b/apps/meteor/app/ui-utils/client/lib/messageContext.js @@ -28,7 +28,7 @@ const fields = { export function messageContext({ rid } = Template.instance()) { const uid = Meteor.userId(); const user = Users.findOne({ _id: uid }, { fields }) || {}; - // const instance = Template.instance(); + const instance = Template.instance(); const openThread = (e) => { const { rid, mid, tmid } = e.currentTarget.dataset; const room = Rooms.findOne({ _id: rid }); @@ -55,7 +55,7 @@ export function messageContext({ rid } = Template.instance()) { value: msg._id, message: msg, }) - : (msg, actionlink) => actionLinks.run(actionlink, msg); + : (msg, actionlink) => actionLinks.run(actionlink, msg, instance); const openDiscussion = (e) => { e.preventDefault(); diff --git a/yarn.lock b/yarn.lock index 455821ae7b85..447810f44a3b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8606,7 +8606,7 @@ __metadata: human-interval: ~1.0.0 moment-timezone: ~0.5.27 mongodb: ~3.5.0 - checksum: acb4ebb7e7356f6e53e810d821eb6aa3d88bbfb9e85183e707517bee6d1eea1f189f38bdf0dd2b91360492ab7643134d510c320d2523d86596498ab98e59735b + checksum: 52010c15379ff6985f91f659db8ccd65b44b2986b46b2a64ca8890657635cc5875154e911ec0eb2e5d188faf576036c951cd9c117fa41261686c4e1d6e27e162 languageName: node linkType: hard @@ -11246,7 +11246,7 @@ __metadata: resolution: "cas@https://github.com/kcbanner/node-cas.git#commit=fcd27dad333223b3b75a048bce27973fb3ca0f62" dependencies: cheerio: 0.19.0 - checksum: 3db182211097cb567d1d7331b03d0fb9ab78467d45158df3da869152dcebcb8c226a0cad18037bddcf5367fc80e1f5e575b66ee53c4e7a68e03e3bd48b65d91b + checksum: e43003b4dcf076f5a41e399cc66edf575ddd10f6cffaa95ed6839f5b71efccd7de716b259319dfca0354bfa5c4c28539e54735095becb356bfab2e28ea236c5e languageName: node linkType: hard @@ -21694,7 +21694,7 @@ __metadata: resolution: "lamejs@https://github.com/zhuker/lamejs.git#commit=582bbba6a12f981b984d8fb9e1874499fed85675" dependencies: use-strict: 1.0.1 - checksum: fa829e0c170a65573e653b4d908a44aaf06a50e1bbade3b1217a300a03ccd59a537e294e2d924a584f9d70c7726a12d4c3af9c675436d48d08be5fb94b5eb400 + checksum: ed7f6f1c9629b53c17023eb04b4fc5a222e9c34fcb4a2f61214488fc64e5cfea825e4588d959c5fb20f3a91f0120103fa60307dd43df995d498ff5ddb6200cd9 languageName: node linkType: hard @@ -21832,7 +21832,7 @@ __metadata: optional: true bin: lessc: ./bin/lessc - checksum: 61568b56b5289fdcfe3d51baf3c13e7db7140022c0a37ef0ae343169f0de927a4b4f4272bc10c20101796e8ee79e934e024051321bba93b3ae071f734309bd98 + checksum: c9646e8377f8ce59648891ecdb7ebf1aea23349d145cc2f7d192785b8ede1677eb2582aa991175dcf18a63a092f81a1d3f8554a2826493f94d6db82b6007f409 languageName: node linkType: hard From 60ae2ca92a1c80d30fbaf2ff9120c2802ebb5945 Mon Sep 17 00:00:00 2001 From: Tasso Evangelista Date: Wed, 25 May 2022 13:48:15 -0300 Subject: [PATCH 4/6] Fix yarn references (again) --- yarn.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/yarn.lock b/yarn.lock index 447810f44a3b..455821ae7b85 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8606,7 +8606,7 @@ __metadata: human-interval: ~1.0.0 moment-timezone: ~0.5.27 mongodb: ~3.5.0 - checksum: 52010c15379ff6985f91f659db8ccd65b44b2986b46b2a64ca8890657635cc5875154e911ec0eb2e5d188faf576036c951cd9c117fa41261686c4e1d6e27e162 + checksum: acb4ebb7e7356f6e53e810d821eb6aa3d88bbfb9e85183e707517bee6d1eea1f189f38bdf0dd2b91360492ab7643134d510c320d2523d86596498ab98e59735b languageName: node linkType: hard @@ -11246,7 +11246,7 @@ __metadata: resolution: "cas@https://github.com/kcbanner/node-cas.git#commit=fcd27dad333223b3b75a048bce27973fb3ca0f62" dependencies: cheerio: 0.19.0 - checksum: e43003b4dcf076f5a41e399cc66edf575ddd10f6cffaa95ed6839f5b71efccd7de716b259319dfca0354bfa5c4c28539e54735095becb356bfab2e28ea236c5e + checksum: 3db182211097cb567d1d7331b03d0fb9ab78467d45158df3da869152dcebcb8c226a0cad18037bddcf5367fc80e1f5e575b66ee53c4e7a68e03e3bd48b65d91b languageName: node linkType: hard @@ -21694,7 +21694,7 @@ __metadata: resolution: "lamejs@https://github.com/zhuker/lamejs.git#commit=582bbba6a12f981b984d8fb9e1874499fed85675" dependencies: use-strict: 1.0.1 - checksum: ed7f6f1c9629b53c17023eb04b4fc5a222e9c34fcb4a2f61214488fc64e5cfea825e4588d959c5fb20f3a91f0120103fa60307dd43df995d498ff5ddb6200cd9 + checksum: fa829e0c170a65573e653b4d908a44aaf06a50e1bbade3b1217a300a03ccd59a537e294e2d924a584f9d70c7726a12d4c3af9c675436d48d08be5fb94b5eb400 languageName: node linkType: hard @@ -21832,7 +21832,7 @@ __metadata: optional: true bin: lessc: ./bin/lessc - checksum: c9646e8377f8ce59648891ecdb7ebf1aea23349d145cc2f7d192785b8ede1677eb2582aa991175dcf18a63a092f81a1d3f8554a2826493f94d6db82b6007f409 + checksum: 61568b56b5289fdcfe3d51baf3c13e7db7140022c0a37ef0ae343169f0de927a4b4f4272bc10c20101796e8ee79e934e024051321bba93b3ae071f734309bd98 languageName: node linkType: hard From 4402538550a8360b809e61fea2d8623b7f180aba Mon Sep 17 00:00:00 2001 From: Hugo Costa Date: Fri, 27 May 2022 10:07:23 -0300 Subject: [PATCH 5/6] Update apps/meteor/app/action-links/client/lib/actionLinks.ts Co-authored-by: Tasso Evangelista --- apps/meteor/app/action-links/client/lib/actionLinks.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/meteor/app/action-links/client/lib/actionLinks.ts b/apps/meteor/app/action-links/client/lib/actionLinks.ts index 42c0a493d366..f4ee56a6c1e9 100644 --- a/apps/meteor/app/action-links/client/lib/actionLinks.ts +++ b/apps/meteor/app/action-links/client/lib/actionLinks.ts @@ -42,7 +42,7 @@ export const actionLinks = { // return message; // }, - run(method: string, message: IMessage, instance: undefined | Function): void { + run(method: string, message: IMessage, instance?: Blaze.TemplateInstance | ((tab: string) => void)): void { const actionLink = message.actionLinks && message.actionLinks.find((action) => action.method_id === method); if (!actionLink) { From 857df7a999a340a6aede64fdd45091f3ea86c1b0 Mon Sep 17 00:00:00 2001 From: Hugo Costa Date: Fri, 27 May 2022 11:45:52 -0300 Subject: [PATCH 6/6] fix: changing instance type --- apps/meteor/app/action-links/client/lib/actionLinks.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/meteor/app/action-links/client/lib/actionLinks.ts b/apps/meteor/app/action-links/client/lib/actionLinks.ts index f4ee56a6c1e9..d4214482096c 100644 --- a/apps/meteor/app/action-links/client/lib/actionLinks.ts +++ b/apps/meteor/app/action-links/client/lib/actionLinks.ts @@ -42,7 +42,7 @@ export const actionLinks = { // return message; // }, - run(method: string, message: IMessage, instance?: Blaze.TemplateInstance | ((tab: string) => void)): void { + run(method: string, message: IMessage, instance?: Blaze.TemplateInstance | Function): void { const actionLink = message.actionLinks && message.actionLinks.find((action) => action.method_id === method); if (!actionLink) {