snapshot of https://github.com/RocketChat/Rocket.Chat.git (develop, 2026-09-16; blobs > 131072B omitted)
Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Code scanning - action / CodeQL-Build (push) Failing after 1s
Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Code scanning - action / CodeQL-Build (push) Failing after 1s
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import { mockAppRoot } from '@rocket.chat/mock-providers';
|
||||
import { screen, act, renderHook } from '@testing-library/react';
|
||||
|
||||
import { useVideoConfOpenCall } from './useVideoConfOpenCall';
|
||||
|
||||
describe('with window.RocketChatDesktop set', () => {
|
||||
beforeEach(() => {
|
||||
window.RocketChatDesktop = {
|
||||
openInternalVideoChatWindow: jest.fn(),
|
||||
} as any;
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
delete window.RocketChatDesktop;
|
||||
});
|
||||
|
||||
it('should pass to videoConfOpenCall the url', async () => {
|
||||
const { result } = renderHook(() => useVideoConfOpenCall(), { wrapper: mockAppRoot().build() });
|
||||
|
||||
const url = faker.internet.url();
|
||||
|
||||
act(() => {
|
||||
result.current(url);
|
||||
});
|
||||
|
||||
expect(window.RocketChatDesktop?.openInternalVideoChatWindow).toHaveBeenCalledWith(url, { providerName: undefined });
|
||||
});
|
||||
|
||||
it('should pass to videoConfOpenCall the url and the providerName', async () => {
|
||||
const { result } = renderHook(() => useVideoConfOpenCall(), { wrapper: mockAppRoot().build() });
|
||||
|
||||
const url = faker.internet.url();
|
||||
const providerName = faker.lorem.word();
|
||||
|
||||
act(() => {
|
||||
result.current(url, providerName);
|
||||
});
|
||||
|
||||
expect(window.RocketChatDesktop?.openInternalVideoChatWindow).toHaveBeenCalledWith(url, {
|
||||
providerName,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('without window.RocketChatDesktop set', () => {
|
||||
const previousWindowOpen = window.open;
|
||||
|
||||
afterAll(() => {
|
||||
window.open = previousWindowOpen;
|
||||
});
|
||||
|
||||
it('should open window', async () => {
|
||||
window.open = jest.fn(() => ({}) as Window);
|
||||
|
||||
const { result } = renderHook(() => useVideoConfOpenCall(), {
|
||||
wrapper: mockAppRoot().build(),
|
||||
});
|
||||
|
||||
const url = faker.internet.url();
|
||||
act(() => {
|
||||
result.current(url);
|
||||
});
|
||||
|
||||
expect(window.open).toHaveBeenCalledWith(url);
|
||||
expect(screen.queryByRole('dialog', { name: 'Open_call_in_new_tab' })).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should NOT open window, AND open modal instead', async () => {
|
||||
window.open = jest.fn(() => null);
|
||||
|
||||
const { result } = renderHook(() => useVideoConfOpenCall(), {
|
||||
wrapper: mockAppRoot().build(),
|
||||
});
|
||||
|
||||
const url = faker.internet.url();
|
||||
act(() => {
|
||||
result.current(url);
|
||||
});
|
||||
|
||||
expect(window.open).toHaveBeenCalledWith(url);
|
||||
expect(window.open).toHaveReturnedWith(null);
|
||||
expect(await screen.findByRole('dialog', { name: 'Open_call_in_new_tab' })).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,30 @@
|
||||
import { useSetModal } from '@rocket.chat/ui-contexts';
|
||||
import { useCallback } from 'react';
|
||||
|
||||
import VideoConfBlockModal from '../VideoConfBlockModal';
|
||||
|
||||
export const useVideoConfOpenCall = () => {
|
||||
const setModal = useSetModal();
|
||||
|
||||
const handleOpenCall = useCallback(
|
||||
(callUrl: string, providerName?: string | undefined) => {
|
||||
const desktopApp = window.RocketChatDesktop;
|
||||
|
||||
if (!desktopApp?.openInternalVideoChatWindow) {
|
||||
const open = () => window.open(callUrl);
|
||||
const popup = open();
|
||||
|
||||
if (popup !== null) {
|
||||
return;
|
||||
}
|
||||
|
||||
setModal(<VideoConfBlockModal onClose={(): void => setModal(null)} onConfirm={open} />);
|
||||
return;
|
||||
}
|
||||
desktopApp.openInternalVideoChatWindow(callUrl, { providerName });
|
||||
},
|
||||
[setModal],
|
||||
);
|
||||
|
||||
return handleOpenCall;
|
||||
};
|
||||
@@ -0,0 +1,11 @@
|
||||
import type { IRoom } from '@rocket.chat/core-typings';
|
||||
import { isDirectMessageRoom } from '@rocket.chat/core-typings';
|
||||
import { useUserDisplayName } from '@rocket.chat/ui-client';
|
||||
import { useUserSubscription } from '@rocket.chat/ui-contexts';
|
||||
|
||||
export const useVideoConfRoomName = (room: IRoom): string | undefined => {
|
||||
const subscription = useUserSubscription(room._id);
|
||||
const username = useUserDisplayName({ name: subscription?.fname, username: subscription?.name });
|
||||
|
||||
return isDirectMessageRoom(room) ? username : room.fname || room.name;
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
import { useStableCallback } from '@rocket.chat/fuselage-hooks';
|
||||
import { useSetModal, useRoute, useRole } from '@rocket.chat/ui-contexts';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
import VideoConfConfigModal from '../VideoConfConfigModal';
|
||||
|
||||
export const useVideoConfWarning = (): ((error: unknown) => void) => {
|
||||
const setModal = useSetModal();
|
||||
const isAdmin = useRole('admin');
|
||||
const videoConfSettingsRoute = useRoute('admin-settings');
|
||||
const handleClose = useStableCallback(() => setModal(null));
|
||||
|
||||
const handleRedirectToConfiguration = useStableCallback(() => {
|
||||
handleClose();
|
||||
videoConfSettingsRoute.push({
|
||||
group: 'Video_Conference',
|
||||
});
|
||||
});
|
||||
|
||||
return useMemo(
|
||||
() => (): void => setModal(<VideoConfConfigModal onClose={handleClose} onConfirm={handleRedirectToConfiguration} isAdmin={isAdmin} />),
|
||||
[handleClose, handleRedirectToConfiguration, isAdmin, setModal],
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user