[mirotalksfu] - add moderator rule - cant chat privately

هذا الالتزام موجود في:
Miroslav Pejic
2023-12-01 14:21:00 +01:00
الأصل f0d2e9f3bd
التزام c629bfabf2
7 ملفات معدلة مع 57 إضافات و6 حذوفات

عرض الملف

@@ -25,6 +25,7 @@ module.exports = class Room {
audio_cant_unmute: false, audio_cant_unmute: false,
video_cant_unhide: false, video_cant_unhide: false,
screen_cant_share: false, screen_cant_share: false,
chat_cant_privately: false,
}; };
this.survey = config.survey; this.survey = config.survey;
this.redirect = config.redirect; this.redirect = config.redirect;
@@ -133,6 +134,9 @@ module.exports = class Room {
case 'screen_cant_share': case 'screen_cant_share':
this._moderator.screen_cant_share = data.status; this._moderator.screen_cant_share = data.status;
break; break;
case 'chat_cant_privately':
this._moderator.chat_cant_privately = data.status;
break;
default: default:
break; break;
} }

عرض الملف

@@ -814,6 +814,7 @@ function startServer() {
case 'audio_cant_unmute': case 'audio_cant_unmute':
case 'video_cant_unhide': case 'video_cant_unhide':
case 'screen_cant_share': case 'screen_cant_share':
case 'chat_cant_privately':
room.broadCast(socket.id, 'updateRoomModerator', moderator); room.broadCast(socket.id, 'updateRoomModerator', moderator);
break; break;
default: default:

عرض الملف

@@ -25,6 +25,7 @@ class LocalStorage {
moderator_audio_cant_unmute: false, // Everyone can't unmute themselves moderator_audio_cant_unmute: false, // Everyone can't unmute themselves
moderator_video_cant_unhide: false, // Everyone can't unhide themselves moderator_video_cant_unhide: false, // Everyone can't unhide themselves
moderator_screen_cant_share: false, // Everyone can't share screen moderator_screen_cant_share: false, // Everyone can't share screen
moderator_chat_cant_privately: false, // Everyone can't chat privately, only Public chat allowed
mic_auto_gain_control: false, mic_auto_gain_control: false,
mic_echo_cancellations: true, mic_echo_cancellations: true,
mic_noise_suppression: true, mic_noise_suppression: true,

عرض الملف

@@ -1905,6 +1905,14 @@ function handleSelects() {
lS.setSettings(lsSettings); lS.setSettings(lsSettings);
e.target.blur(); e.target.blur();
}; };
switchEveryoneCantChatPrivately.onchange = (e) => {
const chatCantPrivately = e.currentTarget.checked;
rc.updateRoomModerator({ type: 'chat_cant_privately', status: chatCantPrivately });
rc.roomMessage('chat_cant_privately', chatCantPrivately);
lsSettings.moderator_chat_cant_privately = chatCantPrivately;
lS.setSettings(lsSettings);
e.target.blur();
};
} }
// #################################################### // ####################################################

عرض الملف

@@ -168,6 +168,7 @@ class RoomClient {
audio_cant_unmute: false, audio_cant_unmute: false,
video_cant_unhide: false, video_cant_unhide: false,
screen_cant_share: false, screen_cant_share: false,
chat_cant_privately: false,
}; };
this.isAudioAllowed = isAudioAllowed; this.isAudioAllowed = isAudioAllowed;
@@ -400,15 +401,17 @@ class RoomClient {
this._moderator.audio_cant_unmute = room.moderator.audio_cant_unmute; this._moderator.audio_cant_unmute = room.moderator.audio_cant_unmute;
this._moderator.video_cant_unhide = room.moderator.video_cant_unhide; this._moderator.video_cant_unhide = room.moderator.video_cant_unhide;
this._moderator.screen_cant_share = room.moderator.screen_cant_share; this._moderator.screen_cant_share = room.moderator.screen_cant_share;
this._moderator.chat_cant_privately = room.moderator.chat_cant_privately;
// //
if (this._moderator.audio_start_muted && this._moderator.video_start_hidden) { if (this._moderator.audio_start_muted && this._moderator.video_start_hidden) {
this.userLog('warning', 'The Moderator disabled your audio and video', 'top-end'); this.userLog('warning', 'The Moderator disabled your audio and video', 'top-end');
} } else {
if (this._moderator.audio_start_muted && !this._moderator.video_start_hidden) { if (this._moderator.audio_start_muted && !this._moderator.video_start_hidden) {
this.userLog('warning', 'The Moderator disabled your audio', 'top-end'); this.userLog('warning', 'The Moderator disabled your audio', 'top-end');
} }
if (!this._moderator.audio_start_muted && this._moderator.video_start_hidden) { if (!this._moderator.audio_start_muted && this._moderator.video_start_hidden) {
this.userLog('warning', 'The Moderator disabled your video', 'top-end'); this.userLog('warning', 'The Moderator disabled your video', 'top-end');
}
} }
// //
this._moderator.audio_cant_unmute ? hide(tabAudioDevicesBtn) : show(tabAudioDevicesBtn); this._moderator.audio_cant_unmute ? hide(tabAudioDevicesBtn) : show(tabAudioDevicesBtn);
@@ -4745,6 +4748,13 @@ class RoomClient {
'top-end', 'top-end',
); );
break; break;
case 'chat_cant_privately':
this.userLog(
'info',
`${icons.moderator} Moderator: everyone can't chat privately ${status}`,
'top-end',
);
break;
default: default:
break; break;
} }
@@ -5531,6 +5541,9 @@ class RoomClient {
this.getId('chatPublicMessages').style.display = 'block'; this.getId('chatPublicMessages').style.display = 'block';
break; break;
default: default:
if (this._moderator.chat_cant_privately) {
return userLog('warning', 'The moderator does not allow you to chat privately', 'top-end', 6000);
}
chatAbout.innerHTML = generateChatAboutHTML(avatarImg, peer_name); chatAbout.innerHTML = generateChatAboutHTML(avatarImg, peer_name);
chatPrivateMessages.style.display = 'block'; chatPrivateMessages.style.display = 'block';
for (let i = 0; i < messagePrivateListItems.length; i++) { for (let i = 0; i < messagePrivateListItems.length; i++) {
@@ -5600,6 +5613,10 @@ class RoomClient {
this._moderator.screen_cant_share = data.status; this._moderator.screen_cant_share = data.status;
rc.roomMessage('screen_cant_share', data.status); rc.roomMessage('screen_cant_share', data.status);
break; break;
case 'chat_cant_privately':
this._moderator.chat_cant_privately = data.status;
rc.roomMessage('chat_cant_privately', data.status);
break;
default: default:
break; break;
} }

عرض الملف

@@ -142,6 +142,7 @@ function handleRules(isPresenter) {
switchEveryoneCantUnmute.checked = lsSettings.moderator_audio_cant_unmute; switchEveryoneCantUnmute.checked = lsSettings.moderator_audio_cant_unmute;
switchEveryoneCantUnhide.checked = lsSettings.moderator_video_cant_unhide; switchEveryoneCantUnhide.checked = lsSettings.moderator_video_cant_unhide;
switchEveryoneCantShareScreen.checked = lsSettings.moderator_screen_cant_share; switchEveryoneCantShareScreen.checked = lsSettings.moderator_screen_cant_share;
switchEveryoneCantChatPrivately.checked = lsSettings.moderator_chat_cant_privately;
// Update moderator settings... // Update moderator settings...
const moderatorData = { const moderatorData = {
audio_start_muted: switchEveryoneMute.checked, audio_start_muted: switchEveryoneMute.checked,
@@ -149,6 +150,7 @@ function handleRules(isPresenter) {
audio_cant_unmute: switchEveryoneCantUnmute.checked, audio_cant_unmute: switchEveryoneCantUnmute.checked,
video_cant_unhide: switchEveryoneCantUnhide.checked, video_cant_unhide: switchEveryoneCantUnhide.checked,
screen_cant_share: switchEveryoneCantShareScreen.checked, screen_cant_share: switchEveryoneCantShareScreen.checked,
chat_cant_privately: switchEveryoneCantChatPrivately.checked,
}; };
rc.updateRoomModeratorALL(moderatorData); rc.updateRoomModeratorALL(moderatorData);
} }

عرض الملف

@@ -698,6 +698,24 @@ access to use this app.
</div> </div>
</td> </td>
</tr> </tr>
<tr id="everyoneCantChatPrivatelyBtn">
<td style="width: auto">
<div class="title">
<i class="fa-solid fa-comments red"></i>
<p>Everyone can't chat privately</p>
</div>
</td>
<td>
<div class="form-check form-switch form-switch-md">
<input
id="switchEveryoneCantChatPrivately"
class="form-check-input"
type="checkbox"
checked
/>
</div>
</td>
</tr>
</table> </table>
</div> </div>