MODERATE_CHAT role can clear the chat in a room, references issue #209
parent
df86c8b493
commit
91a258c273
|
|
@ -1295,6 +1295,28 @@ export default class RoomClient
|
|||
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)
|
||||
{
|
||||
logger.debug('kickPeer() [peerId:"%s"]', peerId);
|
||||
|
|
@ -2152,6 +2174,21 @@ export default class RoomClient
|
|||
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':
|
||||
{
|
||||
const { peerId, magnetUri } = notification.data;
|
||||
|
|
@ -2306,8 +2343,8 @@ export default class RoomClient
|
|||
store.dispatch(requestActions.notify(
|
||||
{
|
||||
text : intl.formatMessage({
|
||||
id : 'moderator.mute',
|
||||
defaultMessage : 'Moderator muted your microphone'
|
||||
id : 'moderator.muteAudio',
|
||||
defaultMessage : 'Moderator muted your audio'
|
||||
})
|
||||
}));
|
||||
}
|
||||
|
|
@ -2325,7 +2362,7 @@ export default class RoomClient
|
|||
store.dispatch(requestActions.notify(
|
||||
{
|
||||
text : intl.formatMessage({
|
||||
id : 'moderator.mute',
|
||||
id : 'moderator.muteVideo',
|
||||
defaultMessage : 'Moderator stopped your video'
|
||||
})
|
||||
}));
|
||||
|
|
|
|||
|
|
@ -15,3 +15,8 @@ export const addChatHistory = (chatHistory) =>
|
|||
type : 'ADD_CHAT_HISTORY',
|
||||
payload : { chatHistory }
|
||||
});
|
||||
|
||||
export const clearChat = () =>
|
||||
({
|
||||
type : 'CLEAR_CHAT'
|
||||
});
|
||||
|
|
@ -129,6 +129,12 @@ export const setCloseMeetingInProgress = (flag) =>
|
|||
payload : { flag }
|
||||
});
|
||||
|
||||
export const setClearChatInProgress = (flag) =>
|
||||
({
|
||||
type : 'CLEAR_CHAT_IN_PROGRESS',
|
||||
payload : { flag }
|
||||
});
|
||||
|
||||
export const setUserRoles = (userRoles) =>
|
||||
({
|
||||
type : 'SET_USER_ROLES',
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import React from 'react';
|
|||
import PropTypes from 'prop-types';
|
||||
import { withStyles } from '@material-ui/core/styles';
|
||||
import Paper from '@material-ui/core/Paper';
|
||||
import ChatModerator from './ChatModerator';
|
||||
import MessageList from './MessageList';
|
||||
import ChatInput from './ChatInput';
|
||||
|
||||
|
|
@ -25,6 +26,7 @@ const Chat = (props) =>
|
|||
|
||||
return (
|
||||
<Paper className={classes.root}>
|
||||
<ChatModerator />
|
||||
<MessageList />
|
||||
<ChatInput />
|
||||
</Paper>
|
||||
|
|
|
|||
|
|
@ -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)));
|
||||
|
|
@ -30,6 +30,11 @@ const chat = (state = [], action) =>
|
|||
return [ ...state, ...chatHistory ];
|
||||
}
|
||||
|
||||
case 'CLEAR_CHAT':
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,11 +22,13 @@ const initialState =
|
|||
muteAllInProgress : false,
|
||||
stopAllVideoInProgress : false,
|
||||
closeMeetingInProgress : false,
|
||||
clearChatInProgress : false,
|
||||
userRoles : { NORMAL: 'normal' }, // Default role
|
||||
permissionsFromRoles : {
|
||||
CHANGE_ROOM_LOCK : [],
|
||||
PROMOTE_PEER : [],
|
||||
SEND_CHAT : [],
|
||||
MODERATE_CHAT : [],
|
||||
SHARE_SCREEN : [],
|
||||
SHARE_FILE : [],
|
||||
MODERATE_ROOM : []
|
||||
|
|
@ -184,6 +186,9 @@ const room = (state = initialState, action) =>
|
|||
case 'CLOSE_MEETING_IN_PROGRESS':
|
||||
return { ...state, closeMeetingInProgress: action.payload.flag };
|
||||
|
||||
case 'CLEAR_CHAT_IN_PROGRESS':
|
||||
return { ...state, clearChatInProgress: action.payload.flag };
|
||||
|
||||
case 'SET_USER_ROLES':
|
||||
{
|
||||
const { userRoles } = action.payload;
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@
|
|||
"room.muteAll": null,
|
||||
"room.stopAllVideo": null,
|
||||
"room.closeMeeting": null,
|
||||
"room.clearChat": null,
|
||||
"room.speechUnsupported": null,
|
||||
|
||||
"me.mutedPTT": null,
|
||||
|
|
@ -143,5 +144,9 @@
|
|||
"devices.screenSharingError": "访问屏幕时发生错误",
|
||||
|
||||
"devices.cameraDisconnected": "相机已断开连接",
|
||||
"devices.cameraError": "访问相机时发生错误"
|
||||
"devices.cameraError": "访问相机时发生错误",
|
||||
|
||||
"moderator.clearChat": null,
|
||||
"moderator.muteAudio": null,
|
||||
"moderator.muteVideo": null
|
||||
}
|
||||
|
|
@ -51,6 +51,7 @@
|
|||
"room.muteAll": null,
|
||||
"room.stopAllVideo": null,
|
||||
"room.closeMeeting": null,
|
||||
"room.clearChat": null,
|
||||
"room.speechUnsupported": null,
|
||||
|
||||
"me.mutedPTT": null,
|
||||
|
|
@ -138,5 +139,9 @@
|
|||
"devices.screenSharingError": "Při přístupu k vaší obrazovce se vyskytla chyba",
|
||||
|
||||
"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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@
|
|||
"room.muteAll": "Alle stummschalten",
|
||||
"room.stopAllVideo": "Alle Videos stoppen",
|
||||
"room.closeMeeting": "Meeting schließen",
|
||||
"room.clearChat": null,
|
||||
"room.speechUnsupported": "Dein Browser unterstützt keine Spracherkennung",
|
||||
|
||||
"me.mutedPTT": "Du bist stummgeschalted, Halte die SPACE-Taste um zu sprechen",
|
||||
|
|
@ -143,5 +144,9 @@
|
|||
"devices.screenSharingError": "Fehler bei der Bildschirmfreigabe",
|
||||
|
||||
"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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@
|
|||
"room.muteAll": null,
|
||||
"room.stopAllVideo": null,
|
||||
"room.closeMeeting": null,
|
||||
"room.clearChat": null,
|
||||
"room.speechUnsupported": null,
|
||||
|
||||
"me.mutedPTT": null,
|
||||
|
|
@ -143,5 +144,9 @@
|
|||
"devices.screenSharingError": "Der opstod en fejl ved adgang til skærmdeling",
|
||||
|
||||
"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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@
|
|||
"room.muteAll": null,
|
||||
"room.stopAllVideo": null,
|
||||
"room.closeMeeting": null,
|
||||
"room.clearChat": null,
|
||||
"room.speechUnsupported": null,
|
||||
|
||||
"me.mutedPTT": null,
|
||||
|
|
@ -143,5 +144,9 @@
|
|||
"devices.screenSharingError": "Παρουσιάστηκε σφάλμα κατά την πρόσβαση στην οθόνη σας",
|
||||
|
||||
"devices.cameraDisconnected": "Η κάμερα αποσυνδέθηκε",
|
||||
"devices.cameraError": "Παρουσιάστηκε σφάλμα κατά την πρόσβαση στην κάμερά σας"
|
||||
"devices.cameraError": "Παρουσιάστηκε σφάλμα κατά την πρόσβαση στην κάμερά σας",
|
||||
|
||||
"moderator.clearChat": null,
|
||||
"moderator.muteAudio": null,
|
||||
"moderator.muteVideo": null
|
||||
}
|
||||
|
|
@ -52,6 +52,7 @@
|
|||
"room.muteAll": "Mute all",
|
||||
"room.stopAllVideo": "Stop all video",
|
||||
"room.closeMeeting": "Close meeting",
|
||||
"room.clearChat": "Clear chat",
|
||||
"room.speechUnsupported": "Your browser does not support speech recognition",
|
||||
|
||||
"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.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"
|
||||
}
|
||||
|
|
@ -52,6 +52,7 @@
|
|||
"room.muteAll": null,
|
||||
"room.stopAllVideo": null,
|
||||
"room.closeMeeting": null,
|
||||
"room.clearChat": null,
|
||||
"room.speechUnsupported": null,
|
||||
|
||||
"me.mutedPTT": null,
|
||||
|
|
@ -143,5 +144,9 @@
|
|||
"devices.screenSharingError": "Hubo un error al acceder a su pantalla",
|
||||
|
||||
"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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@
|
|||
"room.muteAll": null,
|
||||
"room.stopAllVideo": null,
|
||||
"room.closeMeeting": null,
|
||||
"room.clearChat": null,
|
||||
"room.speechUnsupported": null,
|
||||
|
||||
"me.mutedPTT": null,
|
||||
|
|
@ -142,5 +143,9 @@
|
|||
"devices.screenSharingError": "Une erreur est apparue lors de l'accès à votre partage d'écran",
|
||||
|
||||
"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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@
|
|||
"room.muteAll": "Utišaj sve",
|
||||
"room.stopAllVideo": "Ugasi sve kamere",
|
||||
"room.closeMeeting": "Završi sastanak",
|
||||
"room.clearChat": null,
|
||||
"room.speechUnsupported": "Vaš preglednik ne podržava prepoznavanje govora",
|
||||
|
||||
"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.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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@
|
|||
"room.muteAll": null,
|
||||
"room.stopAllVideo": null,
|
||||
"room.closeMeeting": null,
|
||||
"room.clearChat": null,
|
||||
"room.speechUnsupported": null,
|
||||
|
||||
"me.mutedPTT": null,
|
||||
|
|
@ -143,5 +144,9 @@
|
|||
"devices.screenSharingError": "Hiba történt a képernyőd megosztása során",
|
||||
|
||||
"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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@
|
|||
"room.muteAll": null,
|
||||
"room.stopAllVideo": null,
|
||||
"room.closeMeeting": null,
|
||||
"room.clearChat": null,
|
||||
"room.speechUnsupported": null,
|
||||
|
||||
"me.mutedPTT": null,
|
||||
|
|
@ -142,5 +143,9 @@
|
|||
"devices.screenSharingError": "Errore con l'accesso al tuo schermo",
|
||||
|
||||
"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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@
|
|||
"room.muteAll": "Demp alle",
|
||||
"room.stopAllVideo": "Stopp all video",
|
||||
"room.closeMeeting": "Avslutt møte",
|
||||
"room.clearChat": "Tøm chat",
|
||||
"room.speechUnsupported": "Din nettleser støtter ikke stemmegjenkjenning",
|
||||
|
||||
"me.mutedPTT": "Du er dempet, hold nede SPACE for å snakke",
|
||||
|
|
@ -143,5 +144,9 @@
|
|||
"devices.screenSharingError": "Det skjedde noe feil med skjermdelingen din",
|
||||
|
||||
"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"
|
||||
}
|
||||
|
|
@ -52,6 +52,7 @@
|
|||
"room.muteAll": null,
|
||||
"room.stopAllVideo": null,
|
||||
"room.closeMeeting": null,
|
||||
"room.clearChat": null,
|
||||
"room.speechUnsupported": null,
|
||||
|
||||
"me.mutedPTT": null,
|
||||
|
|
@ -143,5 +144,9 @@
|
|||
"devices.screenSharingError": "Wystąpił błąd podczas uzyskiwania dostępu do ekranu",
|
||||
|
||||
"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
|
||||
}
|
||||
|
|
@ -52,6 +52,7 @@
|
|||
"room.muteAll": null,
|
||||
"room.stopAllVideo": null,
|
||||
"room.closeMeeting": null,
|
||||
"room.clearChat": null,
|
||||
"room.speechUnsupported": null,
|
||||
|
||||
"me.mutedPTT": null,
|
||||
|
|
@ -143,5 +144,9 @@
|
|||
"devices.screenSharingError": "Ocorreu um erro no acesso ao seu ecrã",
|
||||
|
||||
"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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@
|
|||
"room.muteAll": null,
|
||||
"room.stopAllVideo": null,
|
||||
"room.closeMeeting": null,
|
||||
"room.clearChat": null,
|
||||
"room.speechUnsupported": null,
|
||||
|
||||
"me.mutedPTT": null,
|
||||
|
|
@ -143,5 +144,9 @@
|
|||
"devices.screenSharingError": "A apărut o eroare la accesarea ecranului",
|
||||
|
||||
"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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,6 +49,11 @@
|
|||
"room.spotlights": "Учасники у центрі уваги",
|
||||
"room.passive": "Пасивні учасники",
|
||||
"room.videoPaused": "Це відео призупинено",
|
||||
"room.muteAll": null,
|
||||
"room.stopAllVideo": null,
|
||||
"room.closeMeeting": null,
|
||||
"room.clearChat": null,
|
||||
"room.speechUnsupported": null,
|
||||
|
||||
"tooltip.login": "Увійти",
|
||||
"tooltip.logout": "Вихід",
|
||||
|
|
@ -136,5 +141,9 @@
|
|||
"devices.screenSharingError": "Сталася помилка під час доступу до екрану",
|
||||
|
||||
"devices.cameraDisconnected": "Камера відключена",
|
||||
"devices.cameraError": "Під час доступу до камери сталася помилка"
|
||||
"devices.cameraError": "Під час доступу до камери сталася помилка",
|
||||
|
||||
"moderator.clearChat": null,
|
||||
"moderator.muteAudio": null,
|
||||
"moderator.muteVideo": null
|
||||
}
|
||||
|
|
@ -229,6 +229,8 @@ module.exports =
|
|||
PROMOTE_PEER : [ userRoles.NORMAL ],
|
||||
// The role(s) have permission to send chat messages
|
||||
SEND_CHAT : [ userRoles.NORMAL ],
|
||||
// The role(s) have permission to moderate chat
|
||||
MODERATE_CHAT : [ userRoles.MODERATOR ],
|
||||
// The role(s) have permission to share screen
|
||||
SHARE_SCREEN : [ userRoles.NORMAL ],
|
||||
// The role(s) have permission to share files
|
||||
|
|
|
|||
|
|
@ -1005,6 +1005,24 @@ class Room extends EventEmitter
|
|||
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':
|
||||
{
|
||||
// Return to sender
|
||||
|
|
@ -1186,9 +1204,7 @@ class Room extends EventEmitter
|
|||
throw new Error('peer not authorized');
|
||||
|
||||
// Spread to others
|
||||
this._notification(peer.socket, 'moderator:mute', {
|
||||
peerId : peer.id
|
||||
}, true);
|
||||
this._notification(peer.socket, 'moderator:mute', null, true);
|
||||
|
||||
cb();
|
||||
|
||||
|
|
@ -1203,9 +1219,7 @@ class Room extends EventEmitter
|
|||
throw new Error('peer not authorized');
|
||||
|
||||
// Spread to others
|
||||
this._notification(peer.socket, 'moderator:stopVideo', {
|
||||
peerId : peer.id
|
||||
}, true);
|
||||
this._notification(peer.socket, 'moderator:stopVideo', null, true);
|
||||
|
||||
cb();
|
||||
|
||||
|
|
@ -1219,12 +1233,7 @@ class Room extends EventEmitter
|
|||
)
|
||||
throw new Error('peer not authorized');
|
||||
|
||||
this._notification(
|
||||
peer.socket,
|
||||
'moderator:kick',
|
||||
null,
|
||||
true
|
||||
);
|
||||
this._notification(peer.socket, 'moderator:kick', null, true);
|
||||
|
||||
cb();
|
||||
|
||||
|
|
@ -1248,10 +1257,7 @@ class Room extends EventEmitter
|
|||
if (!kickPeer)
|
||||
throw new Error(`peer with id "${peerId}" not found`);
|
||||
|
||||
this._notification(
|
||||
kickPeer.socket,
|
||||
'moderator:kick'
|
||||
);
|
||||
this._notification(kickPeer.socket, 'moderator:kick');
|
||||
|
||||
kickPeer.close();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue