mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-17 01:50:47 -04:00
let them chat! (spectators)
This commit is contained in:
@@ -75,10 +75,10 @@ function broadcastMessage(message) {
|
|||||||
|
|
||||||
function handleIncoming({ text } = {}, socket, cb = () => {}) {
|
function handleIncoming({ text } = {}, socket, cb = () => {}) {
|
||||||
const role = getRole(socket);
|
const role = getRole(socket);
|
||||||
if (role === 'spectator') {
|
// if (role === 'spectator') {
|
||||||
cb({ error: 'Spectators cannot chat' });
|
// cb({ error: 'Spectators cannot chat' });
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
const clean = typeof text === 'string' ? text.trim() : '';
|
const clean = typeof text === 'string' ? text.trim() : '';
|
||||||
if (!clean) {
|
if (!clean) {
|
||||||
cb({ error: 'Message required' });
|
cb({ error: 'Message required' });
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ function getNickname(socket) {
|
|||||||
function setNickname(socket, nickname) {
|
function setNickname(socket, nickname) {
|
||||||
if (!socket) return null;
|
if (!socket) return null;
|
||||||
const role = getRole(socket);
|
const role = getRole(socket);
|
||||||
if (role === 'spectator') {
|
// if (role === 'spectator') {
|
||||||
throw new Error('Spectators cannot set nicknames');
|
// throw new Error('Spectators cannot set nicknames');
|
||||||
}
|
// }
|
||||||
const value = sanitizeNickname(nickname);
|
const value = sanitizeNickname(nickname);
|
||||||
if (!value) {
|
if (!value) {
|
||||||
throw new Error('Nickname required');
|
throw new Error('Nickname required');
|
||||||
|
|||||||
Reference in New Issue
Block a user