Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(breakoutRooms): Fix rename.

Hristo Terezov0f5792858585
diff --git a/lang/main.json b/lang/main.json
index 8014a011ab..deb0af7b16 100644
--- a/lang/main.json
+++ b/lang/main.json
@@ -60,9 +60,11 @@
"autoAssign": "Auto assign to breakout rooms",
"close": "Close",
"join": "Join",
+ "leaveBreakoutRoom": "Leave breakout room",
"more": "More",
"remove": "Remove",
"rename": "Rename",
+ "renameBreakoutRoom": "Rename breakout room",
"sendToBreakoutRoom": "Send participant to:"
},
"defaultName": "Breakout room #{{index}}",
@@ -1127,6 +1129,7 @@
"audioOnly": "Toggle audio only",
"audioRoute": "Select the sound device",
"boo": "Boo",
+ "breakoutRoom": "Join/leave breakout room",
"callQuality": "Manage video quality",
"carmode": "Car Mode",
"cc": "Toggle subtitles",
@@ -1242,6 +1245,7 @@
"help": "Help",
"hideWhiteboard": "Hide whiteboard",
"invite": "Invite people",
+ "joinBreakoutRoom": "Join breakout room",
"laugh": "Laugh",
"leaveBreakoutRoom": "Leave breakout room",
"leaveConference": "Leave meeting",
diff --git a/react/features/base/icons/svg/edit.svg b/react/features/base/icons/svg/edit.svg
new file mode 100644
index 0000000000..ef2e6a8f41
--- /dev/null
+++ b/react/features/base/icons/svg/edit.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24">
+ <path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"/>
+</svg>
\ No newline at end of file
diff --git a/react/features/base/icons/svg/index.ts b/react/features/base/icons/svg/index.ts
index 3d24c0f335..26068ad056 100644
--- a/react/features/base/icons/svg/index.ts
+++ b/react/features/base/icons/svg/index.ts
@@ -25,6 +25,7 @@ export { default as IconDeviceHeadphone } from './headset.svg';
export { default as IconDotsHorizontal } from './dots-horizontal.svg';
export { default as IconDownload } from './download.svg';
export { default as IconE2EE } from './e2ee.svg';
+export { default as IconEdit } from './edit.svg';
export { default as IconEnlarge } from './enlarge.svg';
export { default as IconEnterFullscreen } from './enter-fullscreen.svg';
export { default as IconEnvelope } from './envelope.svg';
diff --git a/react/features/breakout-rooms/actions.ts b/react/features/breakout-rooms/actions.ts
index e0cd929a6c..b8975f616c 100644
--- a/react/features/breakout-rooms/actions.ts
+++ b/react/features/breakout-rooms/actions.ts
@@ -84,13 +84,15 @@ export function closeBreakoutRoom(roomId: string) {
* @param {string} name - New name / subject for the breakout room.
* @returns {Function}
*/
-export function renameBreakoutRoom(breakoutRoomJid: string, name: string) {
- return (dispatch: Dispatch<any>, getState: Function) => {
- sendAnalytics(createBreakoutRoomsEvent('rename'));
-
- // $FlowExpectedError
- getCurrentConference(getState)?.getBreakoutRooms()
- ?.renameBreakoutRoom(breakoutRoomJid, name);
+export function renameBreakoutRoom(breakoutRoomJid: string, name = '') {
+ return (_dispatch: IStore['dispatch'], getState: IStore['getState']) => {
+ const trimmedName = name.trim();
+
+ if (trimmedName.length !== 0) {
+ sendAnalytics(createBreakoutRoomsEvent('rename'));
+ getCurrentConference(getState)?.getBreakoutRooms()
+ ?.renameBreakoutRoom(breakoutRoomJid, trimmedName);
+ }
};
}
diff --git a/react/features/participants-pane/components/breakout-rooms/components/AbstractBreakoutRoomNamePrompt.js b/react/features/participants-pane/components/breakout-rooms/components/AbstractBreakoutRoomNamePrompt.js
deleted file mode 100644
index 2170ecd9ac..0000000000
--- a/react/features/participants-pane/components/breakout-rooms/components/AbstractBreakoutRoomNamePrompt.js
+++ /dev/null
@@ -1,84 +0,0 @@
-// @flow
-
-import { Component } from 'react';
-import type { Dispatch } from 'redux';
-
-import { renameBreakoutRoom } from '../../../../breakout-rooms/actions';
-
-/**
- * The type of the React {@code Component} props of
- * {@link AbstractBreakoutRoomNamePrompt}.
- */
-export type Props = {
-
- /**
- * The jid of the breakout room to rename.
- */
- breakoutRoomJid: string,
-
- /**
- * Invoked to update the breakout room's name.
- */
- dispatch: Dispatch<any>,
-
- /**
- * Function to be invoked after a successful breakout room name change.
- */
- onPostSubmit: ?Function,
-
- /**
- * The initial breakout room name.
- */
- initialRoomName: string,
-
- /**
- * Invoked to obtain translated strings.
- */
- t: Function
-};
-
-/**
- * Implements an abstract class for {@code BreakoutRoomNamePrompt}.
- */
-export default class AbstractBreakoutRoomNamePrompt<S: *>
- extends Component <Props, S> {
-
- /**
- * Instantiates a new component.
- *
- * @inheritdoc
- */
- constructor(props: Props) {
- super(props);
-
- this._onRenameBreakoutRoom = this._onRenameBreakoutRoom.bind(this);
- }
-
- _onRenameBreakoutRoom: string => boolean;
-
- /**
- * Dispatches an action to update the breakout room's name. A
- * name must be entered for the action to dispatch.
- *
- * It returns a boolean to comply the Dialog behaviour:
- * {@code true} - the dialog should be closed.
- * {@code false} - the dialog should be left open.
- *
- * @param {string} roomName - The breakout room name.
- * @returns {boolean}
- */
- _onRenameBreakoutRoom(roomName: string) {
-
- if (!roomName || !roomName.trim()) {
- return false;
- }
-
- const { breakoutRoomJid, dispatch, onPostSubmit } = this.props;
-
- dispatch(renameBreakoutRoom(breakoutRoomJid, roomName));
-
- onPostSubmit && onPostSubmit();
-
- return true;
- }
-}
diff --git a/react/features/participants-pane/components/breakout-rooms/components/native/BreakoutRoomContextMenu.tsx b/react/features/participants-pane/components/breakout-rooms/components/native/BreakoutRoomContextMenu.tsx
index ff64573b9a..06b624951c 100644
--- a/react/features/participants-pane/components/breakout-rooms/components/native/BreakoutRoomContextMenu.tsx
+++ b/react/features/participants-pane/components/breakout-rooms/components/native/BreakoutRoomContextMenu.tsx
@@ -6,33 +6,43 @@ import { useDispatch, useSelector } from 'react-redux';
import { createBreakoutRoomsEvent } from '../../../../../analytics/AnalyticsEvents';
import { sendAnalytics } from '../../../../../analytics/functions';
-import { getCurrentConference } from '../../../../../base/conference/functions';
import { hideSheet, openDialog } from '../../../../../base/dialog/actions';
import BottomSheet from '../../../../../base/dialog/components/native/BottomSheet';
import Icon from '../../../../../base/icons/components/Icon';
-import { IconCloseLarge, IconRingGroup } from '../../../../../base/icons/svg';
+import { IconCloseLarge, IconEdit, IconRingGroup } from '../../../../../base/icons/svg';
import { isLocalParticipantModerator } from '../../../../../base/participants/functions';
import { closeBreakoutRoom, moveToRoom, removeBreakoutRoom } from '../../../../../breakout-rooms/actions';
-import { BREAKOUT_ROOMS_RENAME_FEATURE } from '../../../../../breakout-rooms/constants';
import { getBreakoutRoomsConfig } from '../../../../../breakout-rooms/functions';
import { IRoom } from '../../../../../breakout-rooms/types';
+import { isBreakoutRoomRenameAllowed } from '../../../../functions';
+import { BREAKOUT_CONTEXT_MENU_ACTIONS as ACTIONS } from '../../../../types';
import styles from '../../../native/styles';
+import BreakoutRoomNamePrompt from './BreakoutRoomNamePrompt';
+
+/**
+ * An array with all possible breakout rooms actions.
+ */
+const ALL_ACTIONS = [ ACTIONS.JOIN, ACTIONS.REMOVE, ACTIONS.RENAME ];
+
interface IProps {
+ /**
+ * The actions that will be displayed.
+ */
+ actions: Array<ACTIONS>;
+
/**
* The room for which the menu is open.
*/
room: IRoom;
}
-const BreakoutRoomContextMenu = ({ room }: IProps) => {
+const BreakoutRoomContextMenu = ({ room, actions = ALL_ACTIONS }: IProps) => {
const dispatch = useDispatch();
const isLocalModerator = useSelector(isLocalParticipantModerator);
const { hideJoinRoomButton } = useSelector(getBreakoutRoomsConfig);
- const conference = useSelector(getCurrentConference);
- const isRenameBreakoutRoomsSupported
- = conference?.getBreakoutRooms().isFeatureSupported(BREAKOUT_ROOMS_RENAME_FEATURE);
+ const _isBreakoutRoomRenameAllowed = useSelector(isBreakoutRoomRenameAllowed);
const { t } = useTranslation();
const onJoinRoom = useCallback(() => {
@@ -51,6 +61,7 @@ const BreakoutRoomContextMenu = ({ room }: IProps) => {
breakoutRoomJid: room.jid,
initialRoomName: room.name
}));
+ dispatch(hideSheet());
}, [ dispatch, room ]);
const onCloseBreakoutRoom = useCallback(() => {
@@ -63,7 +74,7 @@ const BreakoutRoomContextMenu = ({ room }: IProps) => {
addScrollViewPadding = { false }
showSlidingView = { true }>
{
- !hideJoinRoomButton && (
+ !hideJoinRoomButton && actions.includes(ACTIONS.JOIN) && (
<TouchableOpacity
onPress = { onJoinRoom }
style = { styles.contextMenuItem as ViewStyle }>
@@ -74,17 +85,17 @@ const BreakoutRoomContextMenu = ({ room }: IProps) => {
</TouchableOpacity>
)
}
- {!room?.isMainRoom && isLocalModerator && isRenameBreakoutRoomsSupported
+ {!room?.isMainRoom && actions.includes(ACTIONS.RENAME) && _isBreakoutRoomRenameAllowed
&& <TouchableOpacity
onPress = { onRenameBreakoutRoom }
- style = { styles.contextMenuItem }>
+ style = { styles.contextMenuItem as ViewStyle }>
<Icon
size = { 24 }
src = { IconEdit } />
<Text style = { styles.contextMenuItemText }>{t('breakoutRooms.actions.rename')}</Text>
</TouchableOpacity>
}
- {!room?.isMainRoom && isLocalModerator
+ {!room?.isMainRoom && isLocalModerator && actions.includes(ACTIONS.REMOVE)
&& (room?.participants && Object.keys(room.participants).length > 0
? <TouchableOpacity
onPress = { onCloseBreakoutRoom }
diff --git a/react/features/participants-pane/components/breakout-rooms/components/native/BreakoutRoomNamePrompt.js b/react/features/participants-pane/components/breakout-rooms/components/native/BreakoutRoomNamePrompt.js
deleted file mode 100644
index 613e9ed568..0000000000
--- a/react/features/participants-pane/components/breakout-rooms/components/native/BreakoutRoomNamePrompt.js
+++ /dev/null
@@ -1,30 +0,0 @@
-// @flow
-
-import React from 'react';
-
-import { InputDialog } from '../../../../../base/dialog';
-import { connect } from '../../../../../base/redux';
-import AbstractBreakoutRoomNamePrompt from '../AbstractBreakoutRoomNamePrompt';
-
-/**
- * Implements a component to render a breakout room name prompt.
- */
-class BreakoutRoomNamePrompt extends AbstractBreakoutRoomNamePrompt<*> {
- /**
- * Implements React's {@link Component#render()}.
- *
- * @inheritdoc
- */
- render() {
- return (
- <InputDialog
- contentKey = 'dialog.renameBreakoutRoomTitle'
- initialValue = { this.props.initialRoomName }
- onSubmit = { this._onRenameBreakoutRoom } />
- );
- }
-
- _onRenameBreakoutRoom: () => boolean;
-}
-
-export default connect()(BreakoutRoomNamePrompt);
diff --git a/react/features/participants-pane/components/breakout-rooms/components/native/BreakoutRoomNamePrompt.tsx b/react/features/participants-pane/components/breakout-rooms/components/native/BreakoutRoomNamePrompt.tsx
new file mode 100644
index 0000000000..b6e4230f3e
--- /dev/null
+++ b/react/features/participants-pane/components/breakout-rooms/components/native/BreakoutRoomNamePrompt.tsx
@@ -0,0 +1,34 @@
+import React, { useCallback } from 'react';
+import { useDispatch } from 'react-redux';
+
+import InputDialog from '../../../../../base/dialog/components/native/InputDialog';
+import { renameBreakoutRoom } from '../../../../../breakout-rooms/actions';
+import { IBreakoutRoomNamePromptProps as IProps } from '../../../../types';
+
+/**
+ * Implements a component to render a breakout room name prompt.
+ *
+ * @param {IProps} props - The props of the component.
+ * @returns {JSX.Element}
+ */
+export default function BreakoutRoomNamePrompt({ breakoutRoomJid, initialRoomName }: IProps) {
+ const dispatch = useDispatch();
+ const onSubmit = useCallback((roomName: string) => {
+ const formattedRoomName = roomName?.trim();
+
+ if (formattedRoomName) {
+ dispatch(renameBreakoutRoom(formattedRoomName, roomName));
+
+ return true;
+ }
+
+ return false;
+ }, [ breakoutRoomJid, dispatch ]);
+
+ return (
+ <InputDialog
+ descriptionKey = 'dialog.renameBreakoutRoomTitle'
+ initialValue = { initialRoomName?.trim() }
+ onSubmit = { onSubmit } />
+ );
+}
diff --git a/react/features/participants-pane/components/breakout-rooms/components/web/BreakoutRoomNamePrompt.js b/react/features/participants-pane/components/breakout-rooms/components/web/BreakoutRoomNamePrompt.js
deleted file mode 100644
index 583d7db023..0000000000
--- a/react/features/participants-pane/components/breakout-rooms/components/web/BreakoutRoomNamePrompt.js
+++ /dev/null
@@ -1,117 +0,0 @@
-// @flow
-
-import { FieldTextStateless as TextField } from '@atlaskit/field-text';
-import React from 'react';
-
-import { Dialog } from '../../../../../base/dialog';
-import { translate } from '../../../../../base/i18n';
-import { connect } from '../../../../../base/redux';
-import AbstractBreakoutRoomNamePrompt, {
- type Props
-} from '../AbstractBreakoutRoomNamePrompt';
-
-/**
- * The type of the React {@code Component} props of {@link BreakoutRoomNamePrompt}.
- */
-type State = {
-
- /**
- * Whether the ok button is disabled.
- */
- okDisabled: string,
-
- /**
- * The name to show in the display name text field.
- */
- roomName: string
-};
-
-/**
- * Implements a React {@code Component} for displaying a dialog with an field
- * for setting a breakout room's name.
- *
- * @augments Component
- */
-class BreakoutRoomNamePrompt extends AbstractBreakoutRoomNamePrompt<State> {
-
- /**
- * Initializes a new {@code DisplayNamePrompt} instance.
- *
- * @param {Object} props - The read-only properties with which the new
- * instance is to be initialized.
- */
- constructor(props: Props) {
- super(props);
-
- this.state = {
- okDisabled: true,
- roomName: props.initialRoomName
- };
-
- // Bind event handlers so they are only bound once for every instance.
- this._onBreakoutRoomNameChange = this._onBreakoutRoomNameChange.bind(this);
- this._onSubmit = this._onSubmit.bind(this);
- }
-
- /**
- * Implements React's {@link Component#render()}.
- *
- * @inheritdoc
- * @returns {ReactElement}
- */
- render() {
- return (
- <Dialog
- isModal = { false }
- okDisabled = { this.state.okDisabled }
- onSubmit = { this._onSubmit }
- titleKey = 'dialog.renameBreakoutRoomTitle'
- width = 'small'>
- <TextField
- autoFocus = { true }
- compact = { true }
- label = { this.props.t('dialog.renameBreakoutRoomLabel') }
- name = 'breakoutRoomName'
- onChange = { this._onBreakoutRoomNameChange }
- shouldFitContainer = { true }
- type = 'text'
- value = { this.state.roomName } />
- </Dialog>);
- }
-
- _onBreakoutRoomNameChange: (Object) => void;
-
- /**
- * Updates the entered room name.
- *
- * @param {Object} event - The DOM event triggered from the entered room
- * name value having changed.
- * @private
- * @returns {void}
- */
- _onBreakoutRoomNameChange(event) {
- const roomName = event.target.value;
-
- this.setState({
- okDisabled: !roomName.trim(),
- roomName
- });
- }
-
- _onRenameBreakoutRoom: (string, string) => boolean;
-
- _onSubmit: () => boolean;
-
- /**
- * Dispatches an action to update the breakout room's name. A
- * name must be entered for the action to dispatch.
- *
- * @private
- * @returns {boolean}
- */
- _onSubmit() {
- return this._onRenameBreakoutRoom(this.state.roomName);
- }
-}
-
-export default translate(connect()(BreakoutRoomNamePrompt));
diff --git a/react/features/participants-pane/components/breakout-rooms/components/web/BreakoutRoomNamePrompt.tsx b/react/features/participants-pane/components/breakout-rooms/components/web/BreakoutRoomNamePrompt.tsx
new file mode 100644
index 0000000000..98708084ea
--- /dev/null
+++ b/react/features/participants-pane/components/breakout-rooms/components/web/BreakoutRoomNamePrompt.tsx
@@ -0,0 +1,47 @@
+import React, { useCallback, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+import { useDispatch } from 'react-redux';
+
+import Dialog from '../../../../../base/ui/components/web/Dialog';
+import Input from '../../../../../base/ui/components/web/Input';
+import { renameBreakoutRoom } from '../../../../../breakout-rooms/actions';
+import { IBreakoutRoomNamePromptProps as IProps } from '../../../../types';
+
+/**
+ * Implements a React {@code Component} for displaying a dialog with an field
+ * for setting a breakout room's name.
+ *
+ * @param {IProps} props - The props of the component.
+ * @returns {JSX.Element}
+ */
+export default function BreakoutRoomNamePrompt({ breakoutRoomJid, initialRoomName }: IProps) {
+ const [ roomName, setRoomName ] = useState(initialRoomName?.trim());
+ const { t } = useTranslation();
+ const okDisabled = !roomName;
+ const dispatch = useDispatch();
+ const onBreakoutRoomNameChange = useCallback((newRoomName: string) => {
+ setRoomName(newRoomName?.trim());
+ }, [ setRoomName ]);
+ const onSubmit = useCallback(() => {
+ dispatch(renameBreakoutRoom(breakoutRoomJid, roomName));
+ }, [ breakoutRoomJid, dispatch, roomName ]);
+
+ return (<Dialog
+ ok = {{
+ disabled: okDisabled,
+ translationKey: 'dialog.Ok'
+ }}
+ onSubmit = { onSubmit }
+ titleKey = 'dialog.renameBreakoutRoomTitle'>
+ <Input
+ autoFocus = { true }
+ className = 'dialog-bottom-margin'
+ id = 'breakout-rooms-name-input'
+ label = { t('dialog.renameBreakoutRoomLabel') }
+ name = 'breakoutRoomName'
+ onChange = { onBreakoutRoomNameChange }
+ type = 'text'
+ value = { roomName } />
+ </Dialog>);
+}
+
diff --git a/react/features/participants-pane/components/breakout-rooms/components/web/RenameButton.tsx b/react/features/participants-pane/components/breakout-rooms/components/web/RenameButton.tsx
new file mode 100644
index 0000000000..3d26a4fa99
--- /dev/null
+++ b/react/features/participants-pane/components/breakout-rooms/components/web/RenameButton.tsx
@@ -0,0 +1,53 @@
+import React, { useCallback } from 'react';
+import { useDispatch } from 'react-redux';
+import { makeStyles } from 'tss-react/mui';
+
+import { openDialog } from '../../../../../base/dialog/actions';
+import { IconEdit } from '../../../../../base/icons/svg';
+
+import BreakoutRoomNamePrompt from './BreakoutRoomNamePrompt';
+
+const useStyles = makeStyles()(_theme => {
+ return {
+ container: {
+ position: 'absolute',
+ cursor: 'pointer',
+ marginTop: 2,
+ marginLeft: 5
+ }
+ };
+});
+
+interface IProps {
+ breakoutRoomJid: string;
+ name?: string;
+}
+
+/**
+ * Implements the rename button component which is displayed only for renaming a breakout room which is joined by the
+ * user.
+ *
+ * @param {IProps} props - The props of the component.
+ * @returns {JSX.Element}
+ */
+export default function RenameButton({ breakoutRoomJid, name }: IProps) {
+ const dispatch = useDispatch();
+ const { classes, cx } = useStyles();
+ const onRename = useCallback(() => {
+ dispatch(openDialog(BreakoutRoomNamePrompt, {
+ breakoutRoomJid,
+ initialRoomName: name
+ }));
+ }, [ dispatch, breakoutRoomJid, name ]);
+
+ return (
+ <span
+ className = { cx('jitsi-icon jitsi-icon-default', classes.container) }
+ onClick = { onRename }>
+ <IconEdit
+ height = { 16 }
+ key = { 1 }
+ width = { 16 } />
+ </span>
+ );
+}
diff --git a/react/features/participants-pane/components/breakout-rooms/components/web/RoomContextMenu.tsx b/react/features/participants-pane/components/breakout-rooms/components/web/RoomContextMenu.tsx
index ce4d6aca52..2acea31839 100644
--- a/react/features/participants-pane/components/breakout-rooms/components/web/RoomContextMenu.tsx
+++ b/react/features/participants-pane/components/breakout-rooms/components/web/RoomContextMenu.tsx
@@ -4,16 +4,18 @@ import { useDispatch, useSelector } from 'react-redux';
import { createBreakoutRoomsEvent } from '../../../../../analytics/AnalyticsEvents';
import { sendAnalytics } from '../../../../../analytics/functions';
-import { getCurrentConference } from '../../../../../base/conference/functions';
-import { IconCloseLarge, IconRingGroup } from '../../../../../base/icons/svg';
+import { openDialog } from '../../../../../base/dialog/actions';
+import { IconCloseLarge, IconEdit, IconRingGroup } from '../../../../../base/icons/svg';
import { isLocalParticipantModerator } from '../../../../../base/participants/functions';
import ContextMenu from '../../../../../base/ui/components/web/ContextMenu';
import ContextMenuItemGroup from '../../../../../base/ui/components/web/ContextMenuItemGroup';
import { closeBreakoutRoom, moveToRoom, removeBreakoutRoom } from '../../../../../breakout-rooms/actions';
-import { BREAKOUT_ROOMS_RENAME_FEATURE } from '../../../../../breakout-rooms/constants';
import { IRoom } from '../../../../../breakout-rooms/types';
import { showOverflowDrawer } from '../../../../../toolbox/functions.web';
-import { openDialog } from '../../../../../base/dialog/actions';
+import { isBreakoutRoomRenameAllowed } from '../../../../functions';
+
+import BreakoutRoomNamePrompt from './BreakoutRoomNamePrompt';
+
interface IProps {
@@ -53,9 +55,7 @@ export const RoomContextMenu = ({
const dispatch = useDispatch();
const { t } = useTranslation();
const isLocalModerator = useSelector(isLocalParticipantModerator);
- const conference = useSelector(getCurrentConference);
- const isRenameBreakoutRoomsSupported
- = conference?.getBreakoutRooms().isFeatureSupported(BREAKOUT_ROOMS_RENAME_FEATURE);
+ const _isBreakoutRoomRenameAllowed = useSelector(isBreakoutRoomRenameAllowed);
const _overflowDrawer = useSelector(showOverflowDrawer);
const onJoinRoom = useCallback(() => {
@@ -87,7 +87,7 @@ export const RoomContextMenu = ({
onClick: onJoinRoom,
text: t('breakoutRooms.actions.join')
} : null,
- !room?.isMainRoom && isLocalModerator && isRenameBreakoutRoomsSupported ? {
+ !room?.isMainRoom && _isBreakoutRoomRenameAllowed ? {
accessibilityLabel: t('breakoutRooms.actions.rename'),
icon: IconEdit,
id: `rename-room-${room?.id}`,
diff --git a/react/features/participants-pane/components/native/MeetingParticipantList.tsx b/react/features/participants-pane/components/native/MeetingParticipantList.tsx
index 1cf3cd92c3..b916189414 100644
--- a/react/features/participants-pane/components/native/MeetingParticipantList.tsx
+++ b/react/features/participants-pane/components/native/MeetingParticipantList.tsx
@@ -4,6 +4,7 @@ import { FlatList, Text } from 'react-native';
import { connect } from 'react-redux';
import { IReduxState, IStore } from '../../../app/types';
+import { openSheet } from '../../../base/dialog/actions';
import { translate } from '../../../base/i18n/functions';
import Icon from '../../../base/icons/components/Icon';
import { IconAddUser } from '../../../base/icons/svg';
@@ -24,9 +25,12 @@ import {
import { doInvitePeople } from '../../../invite/actions.native';
import { getInviteOthersControl } from '../../../share-room/functions';
import {
+ isCurrentRoomRenamable,
participantMatchesSearch,
shouldRenderInviteButton
} from '../../functions';
+import { BREAKOUT_CONTEXT_MENU_ACTIONS } from '../../types';
+import BreakoutRoomContextMenu from '../breakout-rooms/components/native/BreakoutRoomContextMenu';
import CollapsibleList from './CollapsibleList';
import MeetingParticipantItem from './MeetingParticipantItem';
@@ -50,6 +54,11 @@ interface IProps extends WithTranslation {
*/
_isAddPeopleFeatureEnabled: boolean;
+ /**
+ * Indicates whether the room that is currently joined can be renamed.
+ */
+ _isCurrentRoomRenamable: boolean;
+
/**
* The local participant.
*/
@@ -126,6 +135,7 @@ class MeetingParticipantList extends PureComponent<IProps> {
this._keyExtractor = this._keyExtractor.bind(this);
this._onInvite = this._onInvite.bind(this);
+ this._openContextMenu = this._openContextMenu.bind(this);
this._renderParticipant = this._renderParticipant.bind(this);
this._onSearchStringChange = this._onSearchStringChange.bind(this);
}
@@ -185,6 +195,18 @@ class MeetingParticipantList extends PureComponent<IProps> {
this.props.setSearchString(text);
}
+ /**
+ * Opens the context menu to rename the current breakout room.
+ *
+ * @returns {void}
+ */
+ _openContextMenu() {
+ this.props.dispatch(openSheet(BreakoutRoomContextMenu, {
+ room: this.props._currentRoom,
+ actions: [ BREAKOUT_CONTEXT_MENU_ACTIONS.RENAME ]
+ }));
+ }
+
/**
* Implements React's {@link Component#render()}.
*
@@ -194,6 +216,7 @@ class MeetingParticipantList extends PureComponent<IProps> {
render() {
const {
_currentRoom,
+ _isCurrentRoomRenamable,
_inviteOthersControl,
_localParticipant,
_participantsCount,
@@ -229,6 +252,7 @@ class MeetingParticipantList extends PureComponent<IProps> {
const _visitorsLabelText = _visitorsCount > 0
? t('participantsPane.headings.visitors', { count: _visitorsCount })
: undefined;
+ const onLongPress = _isCurrentRoomRenamable ? this._openContextMenu : undefined;
return (
<>
@@ -236,7 +260,8 @@ class MeetingParticipantList extends PureComponent<IProps> {
}
<CollapsibleList
containerStyle = { finalContainerStyle }
- title = { title } >
+ onLongPress = { onLongPress }
+ title = { title }>
{
_showInviteButton
&& <Button
@@ -298,6 +323,7 @@ function _mapStateToProps(state: IReduxState) {
return {
_currentRoom,
_isAddPeopleFeatureEnabled,
+ _isCurrentRoomRenamable: isCurrentRoomRenamable(state),
_inviteOthersControl,
_participantsCount,
_remoteParticipants,
diff --git a/react/features/participants-pane/components/web/MeetingParticipants.tsx b/react/features/participants-pane/components/web/MeetingParticipants.tsx
index 8df82a8691..d1468e467c 100644
--- a/react/features/participants-pane/components/web/MeetingParticipants.tsx
+++ b/react/features/participants-pane/components/web/MeetingParticipants.tsx
@@ -16,8 +16,9 @@ import { normalizeAccents } from '../../../base/util/strings.web';
import { getBreakoutRooms, getCurrentRoomId, isInBreakoutRoom } from '../../../breakout-rooms/functions';
import { showOverflowDrawer } from '../../../toolbox/functions.web';
import { muteRemote } from '../../../video-menu/actions.web';
-import { getSortedParticipantIds, shouldRenderInviteButton } from '../../functions';
+import { getSortedParticipantIds, isCurrentRoomRenamable, shouldRenderInviteButton } from '../../functions';
import { useParticipantDrawer } from '../../hooks';
+import RenameButton from '../breakout-rooms/components/web/RenameButton';
import { InviteButton } from './InviteButton';
import MeetingParticipantContextMenu from './MeetingParticipantContextMenu';
@@ -50,7 +51,10 @@ const useStyles = makeStyles()(theme => {
});
interface IProps {
- currentRoom?: { name: string; };
+ currentRoom?: {
+ jid: string;
+ name: string;
+ };
overflowDrawer?: boolean;
participantsCount?: number;
searchString: string;
@@ -102,6 +106,7 @@ function MeetingParticipants({
const youText = t('chat.you');
const isBreakoutRoom = useSelector(isInBreakoutRoom);
const visitorsCount = useSelector((state: IReduxState) => state['features/visitors'].count || 0);
+ const _isCurrentRoomRenamable = useSelector(isCurrentRoomRenamable);
const { classes: styles, cx } = useStyles();
@@ -122,6 +127,10 @@ function MeetingParticipants({
{currentRoom?.name
? `${currentRoom.name} (${participantsCount})`
: t('participantsPane.headings.participantsList', { count: participantsCount })}
+ { currentRoom?.name && _isCurrentRoomRenamable
+ && <RenameButton
+ breakoutRoomJid = { currentRoom?.jid }
+ name = { currentRoom?.name } /> }
</div>
{showInviteButton && <InviteButton />}
<Input
diff --git a/react/features/participants-pane/functions.ts b/react/features/participants-pane/functions.ts
index 9638b774cc..febd9ade53 100644
--- a/react/features/participants-pane/functions.ts
+++ b/react/features/participants-pane/functions.ts
@@ -6,6 +6,7 @@ import {
isSupported
} from '../av-moderation/functions';
import { IStateful } from '../base/app/types';
+import { getCurrentConference } from '../base/conference/functions';
import { INVITE_ENABLED } from '../base/flags/constants';
import { getFeatureFlag } from '../base/flags/functions';
import { MEDIA_TYPE, type MediaType } from '../base/media/constants';
@@ -20,6 +21,7 @@ import {
import { IParticipant } from '../base/participants/types';
import { toState } from '../base/redux/functions';
import { normalizeAccents } from '../base/util/strings';
+import { BREAKOUT_ROOMS_RENAME_FEATURE } from '../breakout-rooms/constants';
import { isInBreakoutRoom } from '../breakout-rooms/functions';
import { MEDIA_STATE, QUICK_ACTION_BUTTON, REDUCER_KEY } from './constants';
@@ -282,3 +284,28 @@ export const isMuteAllVisible = (state: IReduxState) => {
return inBreakoutRoom ? false : !hideMuteAllButton && isLocalModerator;
};
+
+/**
+ * Returns true if reanming the currently joined breakout room is allowed and false otherwise.
+ *
+ * @param {IReduxState} state - The redux state.
+ * @returns {boolean} - True if reanming the currently joined breakout room is allowed and false otherwise.
+ */
+export function isCurrentRoomRenamable(state: IReduxState) {
+ return isInBreakoutRoom(state) && isBreakoutRoomRenameAllowed(state);
+}
+
+/**
+ * Returns true if renaming a breakout room is allowed and false otherwise.
+ *
+ * @param {IReduxState} state - The redux state.
+ * @returns {boolean} - True if renaming a breakout room is allowed and false otherwise.
+ */
+export function isBreakoutRoomRenameAllowed(state: IReduxState) {
+ const isLocalModerator = isLocalParticipantModerator(state);
+ const conference = getCurrentConference(state);
+ const isRenameBreakoutRoomsSupported
+ = conference?.getBreakoutRooms().isFeatureSupported(BREAKOUT_ROOMS_RENAME_FEATURE);
+
+ return isLocalModerator && isRenameBreakoutRoomsSupported;
+}
diff --git a/react/features/participants-pane/types.ts b/react/features/participants-pane/types.ts
new file mode 100644
index 0000000000..03a692a2ab
--- /dev/null
+++ b/react/features/participants-pane/types.ts
@@ -0,0 +1,36 @@
+/**
+ * The type of the React {@code Component} props of {@link BreakoutRoomNamePrompt}.
+ */
+export interface IBreakoutRoomNamePromptProps {
+
+ /**
+ * The jid of the breakout room to rename.
+ */
+ breakoutRoomJid: string;
+
+ /**
+ * The initial breakout room name.
+ */
+ initialRoomName: string;
+}
+
+/**
+ * The available actions for breakout rooms context menu.
+ */
+export enum BREAKOUT_CONTEXT_MENU_ACTIONS {
+
+ /**
+ * Join breakout room.
+ */
+ JOIN = 1,
+
+ /**
+ * Rename breakout room.
+ */
+ RENAME = 2,
+
+ /**
+ * Remove breakout room.
+ */
+ REMOVE = 3
+}
diff --git a/resources/prosody-plugins/mod_jiconop.lua b/resources/prosody-plugins/mod_jiconop.lua
index 7c3fb49cc6..0e0bcadf96 100644
--- a/resources/prosody-plugins/mod_jiconop.lua
+++ b/resources/prosody-plugins/mod_jiconop.lua
@@ -51,6 +51,13 @@ module:hook("resource-bind", function (event)
module:context(lobby_muc_component_config):fire_event('host-disco-info-node',
{origin = session; reply = query; node = 'lobbyrooms';});
+ -- will add a rename feature for breakout rooms.
+ local breakout_rooms_muc_component_config = module:get_option_string('breakout_rooms_muc');
+ if breakout_rooms_muc_component_config then
+ module:context(breakout_rooms_muc_component_config):fire_event('host-disco-info-node',
+ {origin = session; reply = query; node = 'breakout_rooms';});
+ end
+
local stanza = st.message({
from = module.host;
to = session.full_jid; });
diff --git a/resources/prosody-plugins/mod_muc_breakout_rooms.lua b/resources/prosody-plugins/mod_muc_breakout_rooms.lua
index c9e4a8f32d..7723b4b9dc 100644
--- a/resources/prosody-plugins/mod_muc_breakout_rooms.lua
+++ b/resources/prosody-plugins/mod_muc_breakout_rooms.lua
@@ -245,6 +245,12 @@ function rename_breakout_room(room_jid, name)
if main_room then
if main_room._data.breakout_rooms then
main_room._data.breakout_rooms[room_jid] = name;
+ local breakout_room = breakout_rooms_muc_service.get_room_from_jid(room_jid);
+
+ if breakout_room then
+ breakout_room:set_subject(breakout_room.jid, name);
+ end
+
end
main_room:save(true);
broadcast_breakout_rooms(main_room_jid);
@@ -336,12 +342,12 @@ end
function on_breakout_room_pre_create(event)
local breakout_room = event.room;
local main_room, main_room_jid = get_main_room(breakout_room.jid);
+ local name = main_room._data.breakout_rooms[breakout_room.jid];
-- Only allow existent breakout rooms to be started.
-- Authorisation of breakout rooms is done by their random uuid name
- if main_room and main_room._data.breakout_rooms and main_room._data.breakout_rooms[breakout_room.jid] then
- breakout_room._data.subject = main_room._data.breakout_rooms[breakout_room.jid];
- breakout_room.save();
+ if main_room and main_room._data.breakout_rooms and name then
+ breakout_room:set_subject(breakout_room.jid, name);
else
module:log('debug', 'Invalid breakout room %s will not be created.', breakout_room.jid);
breakout_room:destroy(main_room_jid, 'Breakout room is invalid.');