Skip to content

Commit

Permalink
Merge branch 'develop' into fix-reaction-emoji-rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Jan 26, 2023
2 parents 096a644 + 7ecedc4 commit e96cb9d
Show file tree
Hide file tree
Showing 14 changed files with 107 additions and 55 deletions.
15 changes: 9 additions & 6 deletions apps/meteor/app/videobridge/client/tabBar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useMemo, lazy } from 'react';
import { useStableArray, useMutableCallback } from '@rocket.chat/fuselage-hooks';
import { useSetting, useUser } from '@rocket.chat/ui-contexts';
import { useSetting, useUser, useTranslation, usePermission } from '@rocket.chat/ui-contexts';
import { isRoomFederated } from '@rocket.chat/core-typings';

import { useVideoConfDispatchOutgoing, useVideoConfIsCalling, useVideoConfIsRinging } from '../../../client/contexts/VideoConfContext';
Expand All @@ -11,6 +11,7 @@ import { useVideoConfWarning } from '../../../client/views/room/contextualBar/Vi
import { useHasLicenseModule } from '../../../ee/client/hooks/useHasLicenseModule';

addAction('calls', ({ room }) => {
const t = useTranslation();
const hasLicense = useHasLicenseModule('videoconference-enterprise');
const federated = isRoomFederated(room);

Expand All @@ -23,24 +24,26 @@ addAction('calls', ({ room }) => {
icon: 'phone',
title: 'Calls',
...(federated && {
'data-tooltip': 'Video_Call_unavailable_for_federation',
'data-tooltip': t('Video_Call_unavailable_for_this_type_of_room'),
'disabled': true,
}),
template: lazy(() => import('../../../client/views/room/contextualBar/VideoConference/VideoConfList')),
order: 999,
}
: null,
[hasLicense, federated],
[hasLicense, federated, t],
);
});

addAction('start-call', ({ room }) => {
const t = useTranslation();
const user = useUser();
const dispatchWarning = useVideoConfWarning();
const dispatchPopup = useVideoConfDispatchOutgoing();
const isCalling = useVideoConfIsCalling();
const isRinging = useVideoConfIsRinging();
const federated = isRoomFederated(room);
const canPostReadOnly = usePermission('post-readonly', room._id);

const ownUser = room.uids && room.uids.length === 1;

Expand Down Expand Up @@ -89,15 +92,15 @@ addAction('start-call', ({ room }) => {
title: 'Call',
icon: 'phone',
action: handleOpenVideoConf,
...(federated && {
...((federated || (room.ro && !canPostReadOnly)) && {
'data-tooltip': t('Video_Call_unavailable_for_this_type_of_room'),
'disabled': true,
'data-tooltip': 'Video_Call_unavailable_for_federation',
}),
full: true,
order: live ? -1 : 4,
featured: true,
}
: null,
[groups, enableOption, live, handleOpenVideoConf, ownUser, federated],
[groups, enableOption, live, handleOpenVideoConf, ownUser, canPostReadOnly, federated, t, room.ro],
);
});
1 change: 0 additions & 1 deletion apps/meteor/packages/rocketchat-i18n/i18n/de.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -5087,7 +5087,6 @@
"Video_Conference_Description": "Konfigurieren Sie Telefonkonferenzen für Ihren Arbeitsbereich.",
"Video_Chat_Window": "Video-Chat",
"Video_Conference": "Videokonferenz",
"Video_Call_unavailable_for_federation": "Videoanrufe sind für Verbundräume nicht verfügbar",
"Video_Conferences": "Konferenzanrufe",
"video-conf-provider-not-configured": "**Konferenzanruf nicht aktiviert**: Ein Arbeitsbereichsadministrator muss die Funktion \"Konferenzanrufe\" erst aktivieren.",
"Video_message": "Videonachricht",
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -5123,7 +5123,7 @@
"Video_Conference_Description": "Configure conferencing calls for your workspace.",
"Video_Chat_Window": "Video Chat",
"Video_Conference": "Conference Call",
"Video_Call_unavailable_for_federation": "Video Call is unavailable for Federated rooms",
"Video_Call_unavailable_for_this_type_of_room": "Video Call is unavailable for this type of room",
"Video_Conferences": "Conference Calls",
"Video_Conference_Info": "Meeting Information",
"Video_Conference_Url": "Meeting URL",
Expand Down
1 change: 0 additions & 1 deletion apps/meteor/packages/rocketchat-i18n/i18n/fi.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -5063,7 +5063,6 @@
"Video_Conference_Description": "Määritä konferenssipuhelut työtilaa varten.",
"Video_Chat_Window": "Videokeskustelu",
"Video_Conference": "Konferenssipuhelu",
"Video_Call_unavailable_for_federation": "Videopuhelu ei ole käytettävissä Federoiduissa-huoneissa",
"Video_Conferences": "Konferenssipuhelut",
"video-conf-provider-not-configured": "**Konferenssipuhelu ei ole käytössä**: Työtilan ylläpitäjän on ensin otettava konferenssipuhelut käyttöön.",
"Video_message": "VIdeoviesti",
Expand Down
1 change: 0 additions & 1 deletion apps/meteor/packages/rocketchat-i18n/i18n/hu.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -5114,7 +5114,6 @@
"Video_Conference_Description": "Konferenciahívások beállítása a munkaterületéhez.",
"Video_Chat_Window": "Videocsevegés",
"Video_Conference": "Konferenciahívás",
"Video_Call_unavailable_for_federation": "A videohívás nem érhető el föderált szobáknál",
"Video_Conferences": "Konferenciahívások",
"Video_Conference_Info": "Értekezletinformációk",
"Video_Conference_Url": "Értekezlet URL-je",
Expand Down
1 change: 0 additions & 1 deletion apps/meteor/packages/rocketchat-i18n/i18n/pl.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -4987,7 +4987,6 @@
"Video_Conference_Description": "Skonfiguruj połączenia konferencyjne dla swojej przestrzeni roboczej.",
"Video_Chat_Window": "Czat Video",
"Video_Conference": "Konferencja wideo",
"Video_Call_unavailable_for_federation": "Połączenie wideo jest niedostępne dla kanałów skonfederowanych",
"Video_Conferences": "Telekonferencje",
"video-conf-provider-not-configured": "**Połączenie konferencyjne nie jest włączone**: Administrator obszaru roboczego musi najpierw włączyć funkcję połączeń konferencyjnych.",
"Video_message": "Wiadomość wideo",
Expand Down
1 change: 0 additions & 1 deletion apps/meteor/packages/rocketchat-i18n/i18n/ru.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -4768,7 +4768,6 @@
"Video_Conference_Description": "Настройте звонки для вашего сервера.",
"Video_Chat_Window": "Видеочат",
"Video_Conference": "Видеоконференция",
"Video_Call_unavailable_for_federation": "Видеозвонки не доступны для федеративных чатов",
"Video_Conferences": "Звонки",
"video-conf-provider-not-configured": "**Функция звонков не включена**: Администратору сервера необходимо сначала активировать данную функцию.",
"Video_message": "Видеосообщение",
Expand Down
1 change: 0 additions & 1 deletion apps/meteor/packages/rocketchat-i18n/i18n/sv.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -5108,7 +5108,6 @@
"Video_Conference_Description": "Konfigurera konferenssamtal för arbetsytan.",
"Video_Chat_Window": "Videochatt",
"Video_Conference": "Videokonferens",
"Video_Call_unavailable_for_federation": "Videosamtal är inte tillgängliga i federerade rum",
"Video_Conferences": "Konferenssamtal",
"Video_Conference_Info": "Mötesinformation",
"Video_Conference_Url": "Mötes-URL",
Expand Down
7 changes: 3 additions & 4 deletions apps/meteor/tests/e2e/utils/create-target-channel.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
import faker from '@faker-js/faker';
import type { ChannelsCreateProps } from '@rocket.chat/rest-typings';

import type { BaseTest } from './test';

/**
* createTargetChannel:
* - Usefull to create a target channel for message related tests
*/
export async function createTargetChannel(api: BaseTest['api']): Promise<string> {
export async function createTargetChannel(api: BaseTest['api'], options?: Omit<ChannelsCreateProps, 'name'>): Promise<string> {
const name = faker.datatype.uuid();

await api.post('/channels.create', { name });
await api.post('/channels.create', { name, ...options });

return name;
}

export async function createTargetTeam(api: BaseTest['api']): Promise<string> {
const name = faker.datatype.uuid();

await api.post('/teams.create', { name, type: 1, members: ['user2', 'user1'] });

return name;
Expand Down
8 changes: 8 additions & 0 deletions apps/meteor/tests/e2e/video-conference.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ test.use({ storageState: 'user1-session.json' });
test.describe('video conference', () => {
let poHomeChannel: HomeChannel;
let targetChannel: string;
let targetReadOnlyChannel: string;
let targetTeam: string;

test.beforeAll(async ({ api }) => {
targetChannel = await createTargetChannel(api);
targetReadOnlyChannel = await createTargetChannel(api, { readOnly: true });
targetTeam = await createTargetTeam(api);
await createDirectMessage(api);
});
Expand Down Expand Up @@ -84,4 +86,10 @@ test.describe('video conference', () => {
await expect(poHomeChannel.content.videoConfMessageBlock.last()).toBeVisible();
});
});

test('expect create video conference not available in a "targetReadOnlyChannel"', async () => {
await poHomeChannel.sidenav.openChat(targetReadOnlyChannel);

await expect(poHomeChannel.content.btnCall).hasAttribute('disabled');
});
});
17 changes: 1 addition & 16 deletions packages/rest-typings/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,22 +204,7 @@ export * from './v1/settings';
export * from './v1/teams';
export * from './v1/videoConference';
export * from './v1/assets';
export * from './v1/channels/ChannelsAddAllProps';
export * from './v1/channels/ChannelsArchiveProps';
export * from './v1/channels/ChannelsUnarchiveProps';
export * from './v1/channels/ChannelsHistoryProps';
export * from './v1/channels/ChannelsRolesProps';
export * from './v1/channels/ChannelsJoinProps';
export * from './v1/channels/ChannelsKickProps';
export * from './v1/channels/ChannelsLeaveProps';
export * from './v1/channels/ChannelsMessagesProps';
export * from './v1/channels/ChannelsOpenProps';
export * from './v1/channels/ChannelsSetAnnouncementProps';
export * from './v1/channels/ChannelsGetAllUserMentionsByChannelProps';
export * from './v1/channels/ChannelsModeratorsProps';
export * from './v1/channels/ChannelsConvertToTeamProps';
export * from './v1/channels/ChannelsSetReadOnlyProps';
export * from './v1/channels/ChannelsDeleteProps';
export * from './v1/channels';
export * from './v1/subscriptionsEndpoints';
export * from './v1/mailer';
export * from './v1/mailer/MailerParamsPOST';
Expand Down
49 changes: 49 additions & 0 deletions packages/rest-typings/src/v1/channels/ChannelsCreateProps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import Ajv from 'ajv';

const ajv = new Ajv();

export type ChannelsCreateProps = {
name: string;
members?: string[];
readOnly?: boolean;
extraData?: {
broadcast?: boolean;
encrypted?: boolean;
teamId?: string;
};
};

const channelsCreatePropsSchema = {
type: 'object',
properties: {
name: {
type: 'string',
},
members: {
type: 'array',
},
readonly: {
type: 'boolean',
},
extraData: {
type: 'object',
properties: {
broadcast: {
type: 'boolean',
},
encrypted: {
type: 'boolean',
},
teamId: {
type: 'string',
},
},
additionalProperties: false,
nullable: true,
},
},
required: ['name'],
additionalProperties: false,
};

export const isChannelsCreateProps = ajv.compile<ChannelsCreateProps>(channelsCreatePropsSchema);
43 changes: 21 additions & 22 deletions packages/rest-typings/src/v1/channels/channels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,20 @@ import type { PaginatedRequest } from '../../helpers/PaginatedRequest';
import type { PaginatedResult } from '../../helpers/PaginatedResult';
import type { ChannelsAddAllProps } from './ChannelsAddAllProps';
import type { ChannelsArchiveProps } from './ChannelsArchiveProps';
import type { ChannelsConvertToTeamProps } from './ChannelsConvertToTeamProps';
import type { ChannelsCreateProps } from './ChannelsCreateProps';
import type { ChannelsDeleteProps } from './ChannelsDeleteProps';
import type { ChannelsGetAllUserMentionsByChannelProps } from './ChannelsGetAllUserMentionsByChannelProps';
import type { ChannelsHistoryProps } from './ChannelsHistoryProps';
import type { ChannelsJoinProps } from './ChannelsJoinProps';
import type { ChannelsKickProps } from './ChannelsKickProps';
import type { ChannelsLeaveProps } from './ChannelsLeaveProps';
import type { ChannelsMessagesProps } from './ChannelsMessagesProps';
import type { ChannelsModeratorsProps } from './ChannelsModeratorsProps';
import type { ChannelsOpenProps } from './ChannelsOpenProps';
import type { ChannelsRolesProps } from './ChannelsRolesProps';
import type { ChannelsSetAnnouncementProps } from './ChannelsSetAnnouncementProps';
import type { ChannelsSetReadOnlyProps } from './ChannelsSetReadOnlyProps';
import type { ChannelsUnarchiveProps } from './ChannelsUnarchiveProps';

export type ChannelsEndpoints = {
Expand Down Expand Up @@ -39,21 +47,12 @@ export type ChannelsEndpoints = {
POST: (params: ChannelsUnarchiveProps) => void;
};
'/v1/channels.create': {
POST: (params: {
name: string;
members: string[];
readOnly: boolean;
extraData: {
broadcast: boolean;
encrypted: boolean;
teamId?: string;
};
}) => {
POST: (params: ChannelsCreateProps) => {
channel: Omit<IRoom, 'joinCode' | 'members' | 'importIds' | 'e2e'>;
};
};
'/v1/channels.convertToTeam': {
POST: (params: { channelId: string; channelName: string }) => {
POST: (params: ChannelsConvertToTeamProps) => {
team: ITeam;
};
};
Expand All @@ -72,46 +71,46 @@ export type ChannelsEndpoints = {
};
};
'/v1/channels.join': {
POST: (params: { roomId: string; joinCode?: string } | { roomName: string; joinCode?: string }) => {
POST: (params: ChannelsJoinProps) => {
channel: IRoom;
};
};
'/v1/channels.close': {
POST: (params: { roomId: string } | { roomName: string }) => void;
};
'/v1/channels.kick': {
POST: (params: { roomId: string; userId: string } | { roomName: string; userId: string }) => {
POST: (params: ChannelsKickProps) => {
channel: IRoom;
};
};
'/v1/channels.delete': {
POST: (params: ChannelsDeleteProps) => void;
};
'/v1/channels.leave': {
POST: (params: { roomId: string } | { roomName: string }) => {
POST: (params: ChannelsLeaveProps) => {
channel: IRoom;
};
};
'/v1/channels.addModerator': {
POST: (params: { roomId: string; userId: string } | { roomName: string; userId: string }) => void;
POST: (params: ChannelsModeratorsProps) => void;
};
'/v1/channels.removeModerator': {
POST: (params: { roomId: string; userId: string } | { roomName: string; userId: string }) => void;
POST: (params: ChannelsModeratorsProps) => void;
};
'/v1/channels.addOwner': {
POST: (params: { roomId: string; userId: string } | { roomName: string; userId: string }) => void;
POST: (params: ChannelsModeratorsProps) => void;
};
'/v1/channels.removeOwner': {
POST: (params: { roomId: string; userId: string } | { roomName: string; userId: string }) => void;
POST: (params: ChannelsModeratorsProps) => void;
};
'/v1/channels.addLeader': {
POST: (params: { roomId: string; userId: string } | { roomName: string; userId: string }) => void;
POST: (params: ChannelsModeratorsProps) => void;
};
'/v1/channels.removeLeader': {
POST: (params: { roomId: string; userId: string } | { roomName: string; userId: string }) => void;
POST: (params: ChannelsModeratorsProps) => void;
};
'/v1/channels.roles': {
GET: (params: { roomId: string } | { roomName: string }) => { roles: IGetRoomRoles[] };
GET: (params: ChannelsRolesProps) => { roles: IGetRoomRoles[] };
};
'/v1/channels.messages': {
GET: (params: ChannelsMessagesProps) => PaginatedResult<{
Expand All @@ -122,7 +121,7 @@ export type ChannelsEndpoints = {
POST: (params: ChannelsOpenProps) => void;
};
'/v1/channels.setReadOnly': {
POST: (params: { roomId: string; readOnly: boolean } | { roomName: string; readOnly: boolean }) => {
POST: (params: ChannelsSetReadOnlyProps) => {
channel: IRoom;
};
};
Expand Down
15 changes: 15 additions & 0 deletions packages/rest-typings/src/v1/channels/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,18 @@ export * from './channels';

export * from './ChannelsAddAllProps';
export * from './ChannelsArchiveProps';
export * from './ChannelsConvertToTeamProps';
export * from './ChannelsCreateProps';
export * from './ChannelsDeleteProps';
export * from './ChannelsGetAllUserMentionsByChannelProps';
export * from './ChannelsHistoryProps';
export * from './ChannelsJoinProps';
export * from './ChannelsKickProps';
export * from './ChannelsLeaveProps';
export * from './ChannelsMessagesProps';
export * from './ChannelsModeratorsProps';
export * from './ChannelsOpenProps';
export * from './ChannelsRolesProps';
export * from './ChannelsSetAnnouncementProps';
export * from './ChannelsSetReadOnlyProps';
export * from './ChannelsUnarchiveProps';

0 comments on commit e96cb9d

Please sign in to comment.