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(chat): restrict group chat and poll creation by the room permissions too

damencho4d6ec9c9cbdc
diff --git a/react/features/base/conference/reducer.ts b/react/features/base/conference/reducer.ts
index 99debf0df5..ab484807af 100644
--- a/react/features/base/conference/reducer.ts
+++ b/react/features/base/conference/reducer.ts
@@ -91,6 +91,16 @@ export interface IConferenceMetadata {
timestamp: number;
};
};
+
+ /**
+ * The restrictions of the room. A moderator sets them, or the server sets them from the
+ * settings of the meeting when it creates the room.
+ */
+ permissions?: {
+ groupChatRestricted?: boolean;
+ pollCreationRestricted?: boolean;
+ privateChatRestricted?: boolean;
+ };
recording?: {
isRecordingRequested?: boolean;
isTranscribingEnabled: boolean;
diff --git a/react/features/chat/functions.ts b/react/features/chat/functions.ts
index 3450dfcd3e..4cd78c5852 100644
--- a/react/features/chat/functions.ts
+++ b/react/features/chat/functions.ts
@@ -324,13 +324,16 @@ export function getPrivateNoticeMessage(message: IMessage): string {
/**
* Check if participant is not allowed to send group messages.
*
+ * Group chat is restricted either by the dynamic branding or by the room metadata. The server sets
+ * the restriction in the metadata from the settings of the meeting, and a moderator can change it.
+ *
* @param {IReduxState} state - The redux state.
* @returns {boolean} - Returns true if the participant is not allowed to send group messages.
*/
export function isSendGroupChatDisabled(state: IReduxState): boolean {
const { groupChatRequiresPermission } = state['features/dynamic-branding'];
- if (!groupChatRequiresPermission) {
+ if (!groupChatRequiresPermission && !isGroupChatRestricted(state)) {
return false;
}
@@ -351,8 +354,8 @@ export function isGroupChatRestricted(state: IReduxState): boolean {
/**
* Check if participant is not allowed to send private messages.
*
- * Unlike the group chat check above, this reads the restriction from the room
- * metadata, which is what a moderator toggles at runtime. The server applies the
+ * This reads the restriction from the room metadata, which the server sets from
+ * the settings of the meeting and a moderator toggles at runtime. The server applies the
* same check in mod_filter_messages, and pushes the permissions of a participant
* that it promotes to moderator, so this selector follows a promotion.
*
diff --git a/react/features/polls/functions.ts b/react/features/polls/functions.ts
index 97cc9e355f..d4aec8da42 100644
--- a/react/features/polls/functions.ts
+++ b/react/features/polls/functions.ts
@@ -69,6 +69,9 @@ export function hasIdenticalAnswers(currentAnswers: Array<IAnswerData>): boolean
/**
* Check if participant is not allowed to create polls.
*
+ * Poll creation is restricted either by the dynamic branding or by the room metadata. The server
+ * sets the restriction in the metadata from the settings of the meeting.
+ *
* @param {IReduxState} state - The redux state.
* @returns {boolean} - Returns true if the participant is not allowed to create polls.
*/
@@ -78,8 +81,9 @@ export function isCreatePollDisabled(state: IReduxState) {
}
const { pollCreationRequiresPermission } = state['features/dynamic-branding'];
+ const pollCreationRestricted = state['features/base/conference'].metadata?.permissions?.pollCreationRestricted;
- if (!pollCreationRequiresPermission) {
+ if (!pollCreationRequiresPermission && !pollCreationRestricted) {
return false;
}