MODERATE_CHAT role can clear the chat in a room, references issue #209

auto_join_3.3
Håvar Aambø Fosstveit 2020-04-20 23:22:19 +02:00
parent df86c8b493
commit 91a258c273
25 changed files with 417 additions and 161 deletions

View File

@ -1295,6 +1295,28 @@ export default class RoomClient
lobbyPeerActions.setLobbyPeerPromotionInProgress(peerId, false)); lobbyPeerActions.setLobbyPeerPromotionInProgress(peerId, false));
} }
async clearChat()
{
logger.debug('clearChat()');
store.dispatch(
roomActions.setClearChatInProgress(true));
try
{
await this.sendRequest('moderator:clearChat');
store.dispatch(chatActions.clearChat());
}
catch (error)
{
logger.error('clearChat() failed: %o', error);
}
store.dispatch(
roomActions.setClearChatInProgress(false));
}
async kickPeer(peerId) async kickPeer(peerId)
{ {
logger.debug('kickPeer() [peerId:"%s"]', peerId); logger.debug('kickPeer() [peerId:"%s"]', peerId);
@ -2152,6 +2174,21 @@ export default class RoomClient
break; break;
} }
case 'moderator:clearChat':
{
store.dispatch(chatActions.clearChat());
store.dispatch(requestActions.notify(
{
text : intl.formatMessage({
id : 'moderator.clearChat',
defaultMessage : 'Moderator cleared the chat'
})
}));
break;
}
case 'sendFile': case 'sendFile':
{ {
const { peerId, magnetUri } = notification.data; const { peerId, magnetUri } = notification.data;
@ -2306,8 +2343,8 @@ export default class RoomClient
store.dispatch(requestActions.notify( store.dispatch(requestActions.notify(
{ {
text : intl.formatMessage({ text : intl.formatMessage({
id : 'moderator.mute', id : 'moderator.muteAudio',
defaultMessage : 'Moderator muted your microphone' defaultMessage : 'Moderator muted your audio'
}) })
})); }));
} }
@ -2325,7 +2362,7 @@ export default class RoomClient
store.dispatch(requestActions.notify( store.dispatch(requestActions.notify(
{ {
text : intl.formatMessage({ text : intl.formatMessage({
id : 'moderator.mute', id : 'moderator.muteVideo',
defaultMessage : 'Moderator stopped your video' defaultMessage : 'Moderator stopped your video'
}) })
})); }));

View File

@ -15,3 +15,8 @@ export const addChatHistory = (chatHistory) =>
type : 'ADD_CHAT_HISTORY', type : 'ADD_CHAT_HISTORY',
payload : { chatHistory } payload : { chatHistory }
}); });
export const clearChat = () =>
({
type : 'CLEAR_CHAT'
});

View File

@ -129,6 +129,12 @@ export const setCloseMeetingInProgress = (flag) =>
payload : { flag } payload : { flag }
}); });
export const setClearChatInProgress = (flag) =>
({
type : 'CLEAR_CHAT_IN_PROGRESS',
payload : { flag }
});
export const setUserRoles = (userRoles) => export const setUserRoles = (userRoles) =>
({ ({
type : 'SET_USER_ROLES', type : 'SET_USER_ROLES',

View File

@ -2,6 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { withStyles } from '@material-ui/core/styles'; import { withStyles } from '@material-ui/core/styles';
import Paper from '@material-ui/core/Paper'; import Paper from '@material-ui/core/Paper';
import ChatModerator from './ChatModerator';
import MessageList from './MessageList'; import MessageList from './MessageList';
import ChatInput from './ChatInput'; import ChatInput from './ChatInput';
@ -25,6 +26,7 @@ const Chat = (props) =>
return ( return (
<Paper className={classes.root}> <Paper className={classes.root}>
<ChatModerator />
<MessageList /> <MessageList />
<ChatInput /> <ChatInput />
</Paper> </Paper>

View File

@ -0,0 +1,104 @@
import React from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import { withRoomContext } from '../../../RoomContext';
import { withStyles } from '@material-ui/core/styles';
import { useIntl, FormattedMessage } from 'react-intl';
import Button from '@material-ui/core/Button';
const styles = (theme) =>
({
root :
{
padding : theme.spacing(1),
width : '100%',
overflow : 'hidden',
cursor : 'auto',
display : 'flex',
listStyleType : 'none',
boxShadow : '0 2px 5px 2px rgba(0, 0, 0, 0.2)',
backgroundColor : 'rgba(255, 255, 255, 1)'
},
listheader :
{
padding : theme.spacing(1),
fontWeight : 'bolder'
},
actionButton :
{
marginLeft : 'auto'
}
});
const ChatModerator = (props) =>
{
const intl = useIntl();
const {
roomClient,
isChatModerator,
room,
classes
} = props;
if (!isChatModerator)
return;
return (
<ul className={classes.root}>
<li className={classes.listheader}>
<FormattedMessage
id='room.moderatoractions'
defaultMessage='Moderator actions'
/>
</li>
<Button
aria-label={intl.formatMessage({
id : 'room.clearChat',
defaultMessage : 'Clear chat'
})}
className={classes.actionButton}
variant='contained'
color='secondary'
disabled={room.clearChatInProgress}
onClick={() => roomClient.clearChat()}
>
<FormattedMessage
id='room.clearChat'
defaultMessage='Clear chat'
/>
</Button>
</ul>
);
};
ChatModerator.propTypes =
{
roomClient : PropTypes.any.isRequired,
isChatModerator : PropTypes.bool,
room : PropTypes.object,
classes : PropTypes.object.isRequired
};
const mapStateToProps = (state) =>
({
isChatModerator :
state.me.roles.some((role) =>
state.room.permissionsFromRoles.MODERATE_CHAT.includes(role)),
room : state.room
});
export default withRoomContext(connect(
mapStateToProps,
null,
null,
{
areStatesEqual : (next, prev) =>
{
return (
prev.room === next.room &&
prev.me === next.me
);
}
}
)(withStyles(styles)(ChatModerator)));

View File

@ -30,6 +30,11 @@ const chat = (state = [], action) =>
return [ ...state, ...chatHistory ]; return [ ...state, ...chatHistory ];
} }
case 'CLEAR_CHAT':
{
return [];
}
default: default:
return state; return state;
} }

View File

@ -22,11 +22,13 @@ const initialState =
muteAllInProgress : false, muteAllInProgress : false,
stopAllVideoInProgress : false, stopAllVideoInProgress : false,
closeMeetingInProgress : false, closeMeetingInProgress : false,
clearChatInProgress : false,
userRoles : { NORMAL: 'normal' }, // Default role userRoles : { NORMAL: 'normal' }, // Default role
permissionsFromRoles : { permissionsFromRoles : {
CHANGE_ROOM_LOCK : [], CHANGE_ROOM_LOCK : [],
PROMOTE_PEER : [], PROMOTE_PEER : [],
SEND_CHAT : [], SEND_CHAT : [],
MODERATE_CHAT : [],
SHARE_SCREEN : [], SHARE_SCREEN : [],
SHARE_FILE : [], SHARE_FILE : [],
MODERATE_ROOM : [] MODERATE_ROOM : []
@ -184,6 +186,9 @@ const room = (state = initialState, action) =>
case 'CLOSE_MEETING_IN_PROGRESS': case 'CLOSE_MEETING_IN_PROGRESS':
return { ...state, closeMeetingInProgress: action.payload.flag }; return { ...state, closeMeetingInProgress: action.payload.flag };
case 'CLEAR_CHAT_IN_PROGRESS':
return { ...state, clearChatInProgress: action.payload.flag };
case 'SET_USER_ROLES': case 'SET_USER_ROLES':
{ {
const { userRoles } = action.payload; const { userRoles } = action.payload;

View File

@ -52,6 +52,7 @@
"room.muteAll": null, "room.muteAll": null,
"room.stopAllVideo": null, "room.stopAllVideo": null,
"room.closeMeeting": null, "room.closeMeeting": null,
"room.clearChat": null,
"room.speechUnsupported": null, "room.speechUnsupported": null,
"me.mutedPTT": null, "me.mutedPTT": null,
@ -143,5 +144,9 @@
"devices.screenSharingError": "访问屏幕时发生错误", "devices.screenSharingError": "访问屏幕时发生错误",
"devices.cameraDisconnected": "相机已断开连接", "devices.cameraDisconnected": "相机已断开连接",
"devices.cameraError": "访问相机时发生错误" "devices.cameraError": "访问相机时发生错误",
"moderator.clearChat": null,
"moderator.muteAudio": null,
"moderator.muteVideo": null
} }

View File

@ -51,6 +51,7 @@
"room.muteAll": null, "room.muteAll": null,
"room.stopAllVideo": null, "room.stopAllVideo": null,
"room.closeMeeting": null, "room.closeMeeting": null,
"room.clearChat": null,
"room.speechUnsupported": null, "room.speechUnsupported": null,
"me.mutedPTT": null, "me.mutedPTT": null,
@ -138,5 +139,9 @@
"devices.screenSharingError": "Při přístupu k vaší obrazovce se vyskytla chyba", "devices.screenSharingError": "Při přístupu k vaší obrazovce se vyskytla chyba",
"devices.cameraDisconnected": "Kamera odpojena", "devices.cameraDisconnected": "Kamera odpojena",
"devices.cameraError": "Při přístupu k vaší kameře se vyskytla chyba" "devices.cameraError": "Při přístupu k vaší kameře se vyskytla chyba",
"moderator.clearChat": null,
"moderator.muteAudio": null,
"moderator.muteVideo": null
} }

View File

@ -52,6 +52,7 @@
"room.muteAll": "Alle stummschalten", "room.muteAll": "Alle stummschalten",
"room.stopAllVideo": "Alle Videos stoppen", "room.stopAllVideo": "Alle Videos stoppen",
"room.closeMeeting": "Meeting schließen", "room.closeMeeting": "Meeting schließen",
"room.clearChat": null,
"room.speechUnsupported": "Dein Browser unterstützt keine Spracherkennung", "room.speechUnsupported": "Dein Browser unterstützt keine Spracherkennung",
"me.mutedPTT": "Du bist stummgeschalted, Halte die SPACE-Taste um zu sprechen", "me.mutedPTT": "Du bist stummgeschalted, Halte die SPACE-Taste um zu sprechen",
@ -143,5 +144,9 @@
"devices.screenSharingError": "Fehler bei der Bildschirmfreigabe", "devices.screenSharingError": "Fehler bei der Bildschirmfreigabe",
"devices.cameraDisconnected": "Kamera getrennt", "devices.cameraDisconnected": "Kamera getrennt",
"devices.cameraError": "Fehler mit deiner Kamera" "devices.cameraError": "Fehler mit deiner Kamera",
"moderator.clearChat": null,
"moderator.muteAudio": null,
"moderator.muteVideo": null
} }

View File

@ -52,6 +52,7 @@
"room.muteAll": null, "room.muteAll": null,
"room.stopAllVideo": null, "room.stopAllVideo": null,
"room.closeMeeting": null, "room.closeMeeting": null,
"room.clearChat": null,
"room.speechUnsupported": null, "room.speechUnsupported": null,
"me.mutedPTT": null, "me.mutedPTT": null,
@ -143,5 +144,9 @@
"devices.screenSharingError": "Der opstod en fejl ved adgang til skærmdeling", "devices.screenSharingError": "Der opstod en fejl ved adgang til skærmdeling",
"device.cameraDisconnected": "Kamera frakoblet", "device.cameraDisconnected": "Kamera frakoblet",
"device.cameraError": "Der opstod en fejl ved tilkobling af dit kamera" "device.cameraError": "Der opstod en fejl ved tilkobling af dit kamera",
"moderator.clearChat": null,
"moderator.muteAudio": null,
"moderator.muteVideo": null
} }

View File

@ -52,6 +52,7 @@
"room.muteAll": null, "room.muteAll": null,
"room.stopAllVideo": null, "room.stopAllVideo": null,
"room.closeMeeting": null, "room.closeMeeting": null,
"room.clearChat": null,
"room.speechUnsupported": null, "room.speechUnsupported": null,
"me.mutedPTT": null, "me.mutedPTT": null,
@ -143,5 +144,9 @@
"devices.screenSharingError": "Παρουσιάστηκε σφάλμα κατά την πρόσβαση στην οθόνη σας", "devices.screenSharingError": "Παρουσιάστηκε σφάλμα κατά την πρόσβαση στην οθόνη σας",
"devices.cameraDisconnected": "Η κάμερα αποσυνδέθηκε", "devices.cameraDisconnected": "Η κάμερα αποσυνδέθηκε",
"devices.cameraError": "Παρουσιάστηκε σφάλμα κατά την πρόσβαση στην κάμερά σας" "devices.cameraError": "Παρουσιάστηκε σφάλμα κατά την πρόσβαση στην κάμερά σας",
"moderator.clearChat": null,
"moderator.muteAudio": null,
"moderator.muteVideo": null
} }

View File

@ -52,6 +52,7 @@
"room.muteAll": "Mute all", "room.muteAll": "Mute all",
"room.stopAllVideo": "Stop all video", "room.stopAllVideo": "Stop all video",
"room.closeMeeting": "Close meeting", "room.closeMeeting": "Close meeting",
"room.clearChat": "Clear chat",
"room.speechUnsupported": "Your browser does not support speech recognition", "room.speechUnsupported": "Your browser does not support speech recognition",
"me.mutedPTT": "You are muted, hold down SPACE-BAR to talk", "me.mutedPTT": "You are muted, hold down SPACE-BAR to talk",
@ -143,5 +144,9 @@
"devices.screenSharingError": "An error occured while accessing your screen", "devices.screenSharingError": "An error occured while accessing your screen",
"devices.cameraDisconnected": "Camera disconnected", "devices.cameraDisconnected": "Camera disconnected",
"devices.cameraError": "An error occured while accessing your camera" "devices.cameraError": "An error occured while accessing your camera",
"moderator.clearChat": "Moderator cleared the chat",
"moderator.muteAudio": "Moderator muted your audio",
"moderator.muteVideo": "Moderator muted your video"
} }

View File

@ -52,6 +52,7 @@
"room.muteAll": null, "room.muteAll": null,
"room.stopAllVideo": null, "room.stopAllVideo": null,
"room.closeMeeting": null, "room.closeMeeting": null,
"room.clearChat": null,
"room.speechUnsupported": null, "room.speechUnsupported": null,
"me.mutedPTT": null, "me.mutedPTT": null,
@ -143,5 +144,9 @@
"devices.screenSharingError": "Hubo un error al acceder a su pantalla", "devices.screenSharingError": "Hubo un error al acceder a su pantalla",
"devices.cameraDisconnected": "Cámara desconectada", "devices.cameraDisconnected": "Cámara desconectada",
"devices.cameraError": "Hubo un error al acceder a su cámara" "devices.cameraError": "Hubo un error al acceder a su cámara",
"moderator.clearChat": null,
"moderator.muteAudio": null,
"moderator.muteVideo": null
} }

View File

@ -52,6 +52,7 @@
"room.muteAll": null, "room.muteAll": null,
"room.stopAllVideo": null, "room.stopAllVideo": null,
"room.closeMeeting": null, "room.closeMeeting": null,
"room.clearChat": null,
"room.speechUnsupported": null, "room.speechUnsupported": null,
"me.mutedPTT": null, "me.mutedPTT": null,
@ -142,5 +143,9 @@
"devices.screenSharingError": "Une erreur est apparue lors de l'accès à votre partage d'écran", "devices.screenSharingError": "Une erreur est apparue lors de l'accès à votre partage d'écran",
"devices.cameraDisconnected": "Caméra déconnectée", "devices.cameraDisconnected": "Caméra déconnectée",
"devices.cameraError": "Une erreur est apparue lors de l'accès à votre caméra" "devices.cameraError": "Une erreur est apparue lors de l'accès à votre caméra",
"moderator.clearChat": null,
"moderator.muteAudio": null,
"moderator.muteVideo": null
} }

View File

@ -52,6 +52,7 @@
"room.muteAll": "Utišaj sve", "room.muteAll": "Utišaj sve",
"room.stopAllVideo": "Ugasi sve kamere", "room.stopAllVideo": "Ugasi sve kamere",
"room.closeMeeting": "Završi sastanak", "room.closeMeeting": "Završi sastanak",
"room.clearChat": null,
"room.speechUnsupported": "Vaš preglednik ne podržava prepoznavanje govora", "room.speechUnsupported": "Vaš preglednik ne podržava prepoznavanje govora",
"me.mutedPTT": "Utišani ste, pritisnite i držite SPACE tipku za razgovor", "me.mutedPTT": "Utišani ste, pritisnite i držite SPACE tipku za razgovor",
@ -143,5 +144,9 @@
"devices.screenSharingError": "Greška prilikom pristupa ekranu", "devices.screenSharingError": "Greška prilikom pristupa ekranu",
"devices.cameraDisconnected": "Kamera odspojena", "devices.cameraDisconnected": "Kamera odspojena",
"devices.cameraError": "Greška prilikom pristupa kameri" "devices.cameraError": "Greška prilikom pristupa kameri",
"moderator.clearChat": null,
"moderator.muteAudio": null,
"moderator.muteVideo": null
} }

View File

@ -52,6 +52,7 @@
"room.muteAll": null, "room.muteAll": null,
"room.stopAllVideo": null, "room.stopAllVideo": null,
"room.closeMeeting": null, "room.closeMeeting": null,
"room.clearChat": null,
"room.speechUnsupported": null, "room.speechUnsupported": null,
"me.mutedPTT": null, "me.mutedPTT": null,
@ -143,5 +144,9 @@
"devices.screenSharingError": "Hiba történt a képernyőd megosztása során", "devices.screenSharingError": "Hiba történt a képernyőd megosztása során",
"devices.cameraDisconnected": "A kamera kapcsolata lebomlott", "devices.cameraDisconnected": "A kamera kapcsolata lebomlott",
"devices.cameraError": "Hiba történt a kamera elérése során" "devices.cameraError": "Hiba történt a kamera elérése során",
"moderator.clearChat": null,
"moderator.muteAudio": null,
"moderator.muteVideo": null
} }

View File

@ -52,6 +52,7 @@
"room.muteAll": null, "room.muteAll": null,
"room.stopAllVideo": null, "room.stopAllVideo": null,
"room.closeMeeting": null, "room.closeMeeting": null,
"room.clearChat": null,
"room.speechUnsupported": null, "room.speechUnsupported": null,
"me.mutedPTT": null, "me.mutedPTT": null,
@ -142,5 +143,9 @@
"devices.screenSharingError": "Errore con l'accesso al tuo schermo", "devices.screenSharingError": "Errore con l'accesso al tuo schermo",
"devices.cameraDisconnected": "Videocamera scollegata", "devices.cameraDisconnected": "Videocamera scollegata",
"devices.cameraError": "Errore con l'accesso alla videocamera" "devices.cameraError": "Errore con l'accesso alla videocamera",
"moderator.clearChat": null,
"moderator.muteAudio": null,
"moderator.muteVideo": null
} }

View File

@ -52,6 +52,7 @@
"room.muteAll": "Demp alle", "room.muteAll": "Demp alle",
"room.stopAllVideo": "Stopp all video", "room.stopAllVideo": "Stopp all video",
"room.closeMeeting": "Avslutt møte", "room.closeMeeting": "Avslutt møte",
"room.clearChat": "Tøm chat",
"room.speechUnsupported": "Din nettleser støtter ikke stemmegjenkjenning", "room.speechUnsupported": "Din nettleser støtter ikke stemmegjenkjenning",
"me.mutedPTT": "Du er dempet, hold nede SPACE for å snakke", "me.mutedPTT": "Du er dempet, hold nede SPACE for å snakke",
@ -143,5 +144,9 @@
"devices.screenSharingError": "Det skjedde noe feil med skjermdelingen din", "devices.screenSharingError": "Det skjedde noe feil med skjermdelingen din",
"devices.cameraDisconnected": "Kamera koblet fra", "devices.cameraDisconnected": "Kamera koblet fra",
"devices.cameraError": "Det skjedde noe feil med kameraet ditt" "devices.cameraError": "Det skjedde noe feil med kameraet ditt",
"moderator.clearChat": "Moderator tømte chatten",
"moderator.muteAudio": "Moderator mutet lyden din",
"moderator.muteVideo": "Moderator mutet videoen din"
} }

View File

@ -52,6 +52,7 @@
"room.muteAll": null, "room.muteAll": null,
"room.stopAllVideo": null, "room.stopAllVideo": null,
"room.closeMeeting": null, "room.closeMeeting": null,
"room.clearChat": null,
"room.speechUnsupported": null, "room.speechUnsupported": null,
"me.mutedPTT": null, "me.mutedPTT": null,
@ -143,5 +144,9 @@
"devices.screenSharingError": "Wystąpił błąd podczas uzyskiwania dostępu do ekranu", "devices.screenSharingError": "Wystąpił błąd podczas uzyskiwania dostępu do ekranu",
"devices.cameraDisconnected": "Kamera odłączona", "devices.cameraDisconnected": "Kamera odłączona",
"devices.cameraError": "Wystąpił błąd podczas uzyskiwania dostępu do kamery" "devices.cameraError": "Wystąpił błąd podczas uzyskiwania dostępu do kamery",
"moderator.clearChat": null,
"moderator.muteAudio": null,
"moderator.muteVideo": null
} }

View File

@ -52,6 +52,7 @@
"room.muteAll": null, "room.muteAll": null,
"room.stopAllVideo": null, "room.stopAllVideo": null,
"room.closeMeeting": null, "room.closeMeeting": null,
"room.clearChat": null,
"room.speechUnsupported": null, "room.speechUnsupported": null,
"me.mutedPTT": null, "me.mutedPTT": null,
@ -143,5 +144,9 @@
"devices.screenSharingError": "Ocorreu um erro no acesso ao seu ecrã", "devices.screenSharingError": "Ocorreu um erro no acesso ao seu ecrã",
"devices.cameraDisconnected": "Câmara desconectada", "devices.cameraDisconnected": "Câmara desconectada",
"devices.cameraError": "Ocorreu um erro no acesso à sua câmara" "devices.cameraError": "Ocorreu um erro no acesso à sua câmara",
"moderator.clearChat": null,
"moderator.muteAudio": null,
"moderator.muteVideo": null
} }

View File

@ -52,6 +52,7 @@
"room.muteAll": null, "room.muteAll": null,
"room.stopAllVideo": null, "room.stopAllVideo": null,
"room.closeMeeting": null, "room.closeMeeting": null,
"room.clearChat": null,
"room.speechUnsupported": null, "room.speechUnsupported": null,
"me.mutedPTT": null, "me.mutedPTT": null,
@ -143,5 +144,9 @@
"devices.screenSharingError": "A apărut o eroare la accesarea ecranului", "devices.screenSharingError": "A apărut o eroare la accesarea ecranului",
"devices.cameraDisconnected": "Camera video e disconectată", "devices.cameraDisconnected": "Camera video e disconectată",
"devices.cameraError": "A apărut o eroare la accesarea camerei video" "devices.cameraError": "A apărut o eroare la accesarea camerei video",
"moderator.clearChat": null,
"moderator.muteAudio": null,
"moderator.muteVideo": null
} }

View File

@ -1,140 +1,149 @@
{ {
"socket.disconnected": "Ви відключені", "socket.disconnected": "Ви відключені",
"socket.reconnecting": "Ви від'єдналися, намагаєтесь знову підключитися", "socket.reconnecting": "Ви від'єдналися, намагаєтесь знову підключитися",
"socket.reconnected": "Ви знову підключилися", "socket.reconnected": "Ви знову підключилися",
"socket.requestError": "Помилка при запиті сервера", "socket.requestError": "Помилка при запиті сервера",
"room.chooseRoom": "Виберіть назву кімнати, до якої хочете приєднатися", "room.chooseRoom": "Виберіть назву кімнати, до якої хочете приєднатися",
"room.cookieConsent": "Цей веб-сайт використовує файли cookie для поліпшення роботи користувачів", "room.cookieConsent": "Цей веб-сайт використовує файли cookie для поліпшення роботи користувачів",
"room.consentUnderstand": "Я розумію", "room.consentUnderstand": "Я розумію",
"room.joined": "Ви приєдналися до кімнати", "room.joined": "Ви приєдналися до кімнати",
"room.cantJoin": "Неможливо приєднатися до кімнати", "room.cantJoin": "Неможливо приєднатися до кімнати",
"room.youLocked": "Ви заблокували кімнату", "room.youLocked": "Ви заблокували кімнату",
"room.cantLock": "Не вдається заблокувати кімнату", "room.cantLock": "Не вдається заблокувати кімнату",
"room.youUnLocked": "Ви розблокували кімнату", "room.youUnLocked": "Ви розблокували кімнату",
"room.cantUnLock": "Не вдається розблокувати кімнату", "room.cantUnLock": "Не вдається розблокувати кімнату",
"room.locked": "Кімната зараз заблокована", "room.locked": "Кімната зараз заблокована",
"room.unlocked": "Кімната зараз розблокована", "room.unlocked": "Кімната зараз розблокована",
"room.newLobbyPeer": "Новий учасник увійшов у зал очікування", "room.newLobbyPeer": "Новий учасник увійшов у зал очікування",
"room.lobbyPeerLeft": "Учасник вийшов із зала очікування", "room.lobbyPeerLeft": "Учасник вийшов із зала очікування",
"room.lobbyPeerChangedDisplayName": "Учасник у залі очікування змінив ім'я на {displayName}", "room.lobbyPeerChangedDisplayName": "Учасник у залі очікування змінив ім'я на {displayName}",
"room.lobbyPeerChangedPicture": "Учасник залу очікування змінив зображення", "room.lobbyPeerChangedPicture": "Учасник залу очікування змінив зображення",
"room.setAccessCode": "Код доступу до кімнати оновлений", "room.setAccessCode": "Код доступу до кімнати оновлений",
"room.accessCodeOn": "Код доступу до кімнати зараз активований", "room.accessCodeOn": "Код доступу до кімнати зараз активований",
"room.accessCodeOff": "Код доступу до кімнати зараз відключений", "room.accessCodeOff": "Код доступу до кімнати зараз відключений",
"room.peerChangedDisplayName": "{oldDisplayName} змінив ім'я на {displayName}", "room.peerChangedDisplayName": "{oldDisplayName} змінив ім'я на {displayName}",
"room.newPeer": "{displayName} приєднався до кімнати", "room.newPeer": "{displayName} приєднався до кімнати",
"room.newFile": "Новий файл є у доступі", "room.newFile": "Новий файл є у доступі",
"room.toggleAdvancedMode": "Увімкнено розширений режим", "room.toggleAdvancedMode": "Увімкнено розширений режим",
"room.setDemocratView": "Змінено макет на демократичний вигляд", "room.setDemocratView": "Змінено макет на демократичний вигляд",
"room.setFilmStripView": "Змінено макет на вид фільму", "room.setFilmStripView": "Змінено макет на вид фільму",
"room.loggedIn": "Ви ввійшли в систему", "room.loggedIn": "Ви ввійшли в систему",
"room.loggedOut": "Ви вийшли з системи", "room.loggedOut": "Ви вийшли з системи",
"room.changedDisplayName": "Відображуване ім’я змінено на {displayName}", "room.changedDisplayName": "Відображуване ім’я змінено на {displayName}",
"room.changeDisplayNameError": "Сталася помилка під час зміни вашого відображуваного імені", "room.changeDisplayNameError": "Сталася помилка під час зміни вашого відображуваного імені",
"room.chatError": "Не вдається надіслати повідомлення в чаті", "room.chatError": "Не вдається надіслати повідомлення в чаті",
"room.aboutToJoin": "Ви збираєтесь приєднатися до зустрічі", "room.aboutToJoin": "Ви збираєтесь приєднатися до зустрічі",
"room.roomId": "Ідентифікатор кімнати: {roomName}", "room.roomId": "Ідентифікатор кімнати: {roomName}",
"room.setYourName": "Встановіть своє ім'я для участі та виберіть, як ви хочете приєднатися:", "room.setYourName": "Встановіть своє ім'я для участі та виберіть, як ви хочете приєднатися:",
"room.audioOnly": "Тільки аудіо", "room.audioOnly": "Тільки аудіо",
"room.audioVideo": "Аудіо та відео", "room.audioVideo": "Аудіо та відео",
"room.youAreReady": "Добре, ви готові", "room.youAreReady": "Добре, ви готові",
"room.emptyRequireLogin": "Кімната порожня! Ви можете увійти, щоб розпочати зустріч або чекати, поки хост приєднається", "room.emptyRequireLogin": "Кімната порожня! Ви можете увійти, щоб розпочати зустріч або чекати, поки хост приєднається",
"room.locketWait": "Кімната заблокована - дочекайтеся, поки хтось не впустить вас у ...", "room.locketWait": "Кімната заблокована - дочекайтеся, поки хтось не впустить вас у ...",
"room.lobbyAdministration": "Адміністрація залу очікування", "room.lobbyAdministration": "Адміністрація залу очікування",
"room.peersInLobby": "Учасники залу очікувань", "room.peersInLobby": "Учасники залу очікувань",
"room.lobbyEmpty": "Наразі у залі очікувань немає нікого", "room.lobbyEmpty": "Наразі у залі очікувань немає нікого",
"room.hiddenPeers": "{hiddenPeersCount, множина, один {учасник} інший {учасників}}", "room.hiddenPeers": "{hiddenPeersCount, множина, один {учасник} інший {учасників}}",
"room.me": "Я", "room.me": "Я",
"room.spotlights": "Учасники у центрі уваги", "room.spotlights": "Учасники у центрі уваги",
"room.passive": "Пасивні учасники", "room.passive": "Пасивні учасники",
"room.videoPaused": "Це відео призупинено", "room.videoPaused": "Це відео призупинено",
"room.muteAll": null,
"room.stopAllVideo": null,
"room.closeMeeting": null,
"room.clearChat": null,
"room.speechUnsupported": null,
"tooltip.login": "Увійти", "tooltip.login": "Увійти",
"tooltip.logout": "Вихід", "tooltip.logout": "Вихід",
"tooltip.admitFromLobby": "Вхід із залу очікувань", "tooltip.admitFromLobby": "Вхід із залу очікувань",
"tooltip.lockRoom": "Заблокувати кімнату", "tooltip.lockRoom": "Заблокувати кімнату",
"tooltip.unLockRoom": "Розблокувати кімнату", "tooltip.unLockRoom": "Розблокувати кімнату",
"tooltip.enterFullscreen": "Вивести повний екран", "tooltip.enterFullscreen": "Вивести повний екран",
"tooltip.leaveFullscreen": "Залишити повноекранний екран", "tooltip.leaveFullscreen": "Залишити повноекранний екран",
"tooltip.lobby": "Показати зал очікувань", "tooltip.lobby": "Показати зал очікувань",
"tooltip.settings": "Показати налаштування", "tooltip.settings": "Показати налаштування",
"tooltip.participants": "Показати учасників", "tooltip.participants": "Показати учасників",
"label.roomName": "Назва кімнати", "label.roomName": "Назва кімнати",
"label.chooseRoomButton": "Продовжити", "label.chooseRoomButton": "Продовжити",
"label.yourName": "Ваше ім'я", "label.yourName": "Ваше ім'я",
"label.newWindow": "Нове вікно", "label.newWindow": "Нове вікно",
"label.fullscreen": "Повний екран", "label.fullscreen": "Повний екран",
"label.openDrawer": "Відкрити ящик", "label.openDrawer": "Відкрити ящик",
"label.leave": "Залишити", "label.leave": "Залишити",
"label.chatInput": "Введіть повідомлення чату ...", "label.chatInput": "Введіть повідомлення чату ...",
"label.chat": "Чат", "label.chat": "Чат",
"label.filesharing": "Обмін файлами", "label.filesharing": "Обмін файлами",
"label.participants": "Учасники", "label.participants": "Учасники",
"label.shareFile": "Надіслати файл", "label.shareFile": "Надіслати файл",
"label.fileSharingUnsupported": "Обмін файлами не підтримується", "label.fileSharingUnsupported": "Обмін файлами не підтримується",
"label.unknown": "Невідомо", "label.unknown": "Невідомо",
"label.democrat": "Демократичний вигляд", "label.democrat": "Демократичний вигляд",
"label.filmstrip": "У вигляді кінострічки", "label.filmstrip": "У вигляді кінострічки",
"label.low": "Низький", "label.low": "Низький",
"label.medium": "Середній", "label.medium": "Середній",
"label.high": "Високий (HD)", "label.high": "Високий (HD)",
"label.veryHigh": "Дуже високий (FHD)", "label.veryHigh": "Дуже високий (FHD)",
"label.ultra": "Ультра (UHD)", "label.ultra": "Ультра (UHD)",
"label.close": "Закрити", "label.close": "Закрити",
"settings.settings": "Налаштування", "settings.settings": "Налаштування",
"settings.camera": "Камера", "settings.camera": "Камера",
"settings.selectCamera": "Вибрати відеопристрій", "settings.selectCamera": "Вибрати відеопристрій",
"settings.cantSelectCamera": "Неможливо вибрати відеопристрій", "settings.cantSelectCamera": "Неможливо вибрати відеопристрій",
"settings.audio": "Аудіопристрій", "settings.audio": "Аудіопристрій",
"settings.selectAudio": "Вибрати аудіопристрій", "settings.selectAudio": "Вибрати аудіопристрій",
"settings.cantSelectAudio": "Неможливо вибрати аудіопристрій", "settings.cantSelectAudio": "Неможливо вибрати аудіопристрій",
"settings.resolution": "Виберіть роздільну здатність відео", "settings.resolution": "Виберіть роздільну здатність відео",
"settings.layout": "Розміщення кімнати", "settings.layout": "Розміщення кімнати",
"settings.selectRoomLayout": "Вибір розташування кімнати", "settings.selectRoomLayout": "Вибір розташування кімнати",
"settings.advancedMode": "Розширений режим", "settings.advancedMode": "Розширений режим",
"settings.permanentTopBar": "Постійний верхній рядок", "settings.permanentTopBar": "Постійний верхній рядок",
"settings.lastn": "Кількість видимих ​​відео", "settings.lastn": "Кількість видимих ​​відео",
"filesharing.saveFileError": "Неможливо зберегти файл", "filesharing.saveFileError": "Неможливо зберегти файл",
"filesharing.startingFileShare": "Спроба поділитися файлом", "filesharing.startingFileShare": "Спроба поділитися файлом",
"filesharing.successfulFileShare": "Файл готовий для обміну", "filesharing.successfulFileShare": "Файл готовий для обміну",
"filesharing.unableToShare": "Неможливо поділитися файлом", "filesharing.unableToShare": "Неможливо поділитися файлом",
"filesharing.error": "Виникла помилка обміну файлами", "filesharing.error": "Виникла помилка обміну файлами",
"filesharing.finished": "Завантаження файлу закінчено", "filesharing.finished": "Завантаження файлу закінчено",
"filesharing.save": "Зберегти", "filesharing.save": "Зберегти",
"filesharing.sharedFile": "{displayName} поділився файлом", "filesharing.sharedFile": "{displayName} поділився файлом",
"filesharing.download": "Завантажити", "filesharing.download": "Завантажити",
"filesharing.missingSeeds": "Якщо цей процес триває тривалий час, може не з’явиться хтось, хто роздає цей торрент. Спробуйте попросити когось перезавантажити потрібний файл.", "filesharing.missingSeeds": "Якщо цей процес триває тривалий час, може не з’явиться хтось, хто роздає цей торрент. Спробуйте попросити когось перезавантажити потрібний файл.",
"devices.devicesChanged": "Ваші пристрої змінилися, налаштуйте ваші пристрої в діалоговому вікні налаштувань", "devices.devicesChanged": "Ваші пристрої змінилися, налаштуйте ваші пристрої в діалоговому вікні налаштувань",
"device.audioUnsupported": "Аудіо не підтримується", "device.audioUnsupported": "Аудіо не підтримується",
"device.activateAudio": "Активувати звук", "device.activateAudio": "Активувати звук",
"device.muteAudio": "Вимкнути звук", "device.muteAudio": "Вимкнути звук",
"device.unMuteAudio": "Увімкнути звук", "device.unMuteAudio": "Увімкнути звук",
"device.videoUnsupported": "Відео не підтримується", "device.videoUnsupported": "Відео не підтримується",
"device.startVideo": "Запустити відео", "device.startVideo": "Запустити відео",
"device.stopVideo": "Зупинити відео", "device.stopVideo": "Зупинити відео",
"device.screenSharingUnsupported": "Обмін екраном не підтримується", "device.screenSharingUnsupported": "Обмін екраном не підтримується",
"device.startScreenSharing": "Початок спільного використання екрана", "device.startScreenSharing": "Початок спільного використання екрана",
"device.stopScreenSharing": "Зупинити спільний доступ до екрана", "device.stopScreenSharing": "Зупинити спільний доступ до екрана",
"devices.microphoneDisconnected": "Мікрофон відключений", "devices.microphoneDisconnected": "Мікрофон відключений",
"devices.microphoneError": "Сталася помилка під час доступу до мікрофона", "devices.microphoneError": "Сталася помилка під час доступу до мікрофона",
"devices.microPhoneMute": "Вимкнено ваш мікрофон", "devices.microPhoneMute": "Вимкнено ваш мікрофон",
"devices.micophoneUnMute": "Не ввімкнено ваш мікрофон", "devices.micophoneUnMute": "Не ввімкнено ваш мікрофон",
"devices.microphoneEnable": "Увімкнено мікрофон", "devices.microphoneEnable": "Увімкнено мікрофон",
"devices.microphoneMuteError": "Не вдається вимкнути мікрофон", "devices.microphoneMuteError": "Не вдається вимкнути мікрофон",
"devices.microphoneUnMuteError": "Неможливо ввімкнути мікрофон", "devices.microphoneUnMuteError": "Неможливо ввімкнути мікрофон",
"devices.screenSharingDisconnected": "Спільний доступ до екрана відключений", "devices.screenSharingDisconnected": "Спільний доступ до екрана відключений",
"devices.screenSharingError": "Сталася помилка під час доступу до екрану", "devices.screenSharingError": "Сталася помилка під час доступу до екрану",
"devices.cameraDisconnected": "Камера відключена", "devices.cameraDisconnected": "Камера відключена",
"devices.cameraError": "Під час доступу до камери сталася помилка" "devices.cameraError": "Під час доступу до камери сталася помилка",
"moderator.clearChat": null,
"moderator.muteAudio": null,
"moderator.muteVideo": null
} }

View File

@ -229,6 +229,8 @@ module.exports =
PROMOTE_PEER : [ userRoles.NORMAL ], PROMOTE_PEER : [ userRoles.NORMAL ],
// The role(s) have permission to send chat messages // The role(s) have permission to send chat messages
SEND_CHAT : [ userRoles.NORMAL ], SEND_CHAT : [ userRoles.NORMAL ],
// The role(s) have permission to moderate chat
MODERATE_CHAT : [ userRoles.MODERATOR ],
// The role(s) have permission to share screen // The role(s) have permission to share screen
SHARE_SCREEN : [ userRoles.NORMAL ], SHARE_SCREEN : [ userRoles.NORMAL ],
// The role(s) have permission to share files // The role(s) have permission to share files

View File

@ -1005,6 +1005,24 @@ class Room extends EventEmitter
break; break;
} }
case 'moderator:clearChat':
{
if (
!peer.roles.some((role) => config.permissionsFromRoles.MODERATE_CHAT.includes(role))
)
throw new Error('peer not authorized');
this._chatHistory = [];
// Spread to others
this._notification(peer.socket, 'moderator:clearChat', null, true);
// Return no error
cb();
break;
}
case 'serverHistory': case 'serverHistory':
{ {
// Return to sender // Return to sender
@ -1186,9 +1204,7 @@ class Room extends EventEmitter
throw new Error('peer not authorized'); throw new Error('peer not authorized');
// Spread to others // Spread to others
this._notification(peer.socket, 'moderator:mute', { this._notification(peer.socket, 'moderator:mute', null, true);
peerId : peer.id
}, true);
cb(); cb();
@ -1203,9 +1219,7 @@ class Room extends EventEmitter
throw new Error('peer not authorized'); throw new Error('peer not authorized');
// Spread to others // Spread to others
this._notification(peer.socket, 'moderator:stopVideo', { this._notification(peer.socket, 'moderator:stopVideo', null, true);
peerId : peer.id
}, true);
cb(); cb();
@ -1219,12 +1233,7 @@ class Room extends EventEmitter
) )
throw new Error('peer not authorized'); throw new Error('peer not authorized');
this._notification( this._notification(peer.socket, 'moderator:kick', null, true);
peer.socket,
'moderator:kick',
null,
true
);
cb(); cb();
@ -1248,10 +1257,7 @@ class Room extends EventEmitter
if (!kickPeer) if (!kickPeer)
throw new Error(`peer with id "${peerId}" not found`); throw new Error(`peer with id "${peerId}" not found`);
this._notification( this._notification(kickPeer.socket, 'moderator:kick');
kickPeer.socket,
'moderator:kick'
);
kickPeer.close(); kickPeer.close();