ready for PR/review
This commit is contained in:
+22
-22
@@ -46,11 +46,8 @@ const chat = io => {
|
||||
|
||||
socket.join(socket.user.room);
|
||||
|
||||
//broadcast to this room
|
||||
socket.broadcast.to(socket.user.room).emit('message', {timestamp: log.createdAt, emphasis: true, text: `${socket.user.username} entered chat` });
|
||||
|
||||
//log
|
||||
chatlog.create({
|
||||
const log = await chatlog.create({
|
||||
notification: true,
|
||||
username: socket.user.username,
|
||||
text: `${socket.user.username} entered chat`,
|
||||
@@ -58,6 +55,9 @@ const chat = io => {
|
||||
emphasis: true
|
||||
});
|
||||
|
||||
//broadcast to this room
|
||||
socket.broadcast.to(socket.user.room).emit('message', {timestamp: log.createdAt, emphasis: true, text: `${socket.user.username} entered chat` });
|
||||
|
||||
//send backlog to the user
|
||||
chatlog.findAll({
|
||||
where: {
|
||||
@@ -129,7 +129,7 @@ const chat = io => {
|
||||
socket.broadcast.to(socket.user.room || '.error').emit('message', { emphasis: true, text: `${socket.user.username} left chat` });
|
||||
|
||||
//log
|
||||
chatlog.create({
|
||||
const log = await chatlog.create({
|
||||
notification: true,
|
||||
username: socket.user.username,
|
||||
text: `${socket.user.username} left chat`,
|
||||
@@ -164,11 +164,8 @@ const executeCommand = (io, socket, command) => {
|
||||
break;
|
||||
}
|
||||
|
||||
//broadcast to the old room
|
||||
socket.broadcast.to(socket.user.room).emit('message', { emphasis: true, text: `${socket.user.username} left the room (going to ${room})` });
|
||||
|
||||
//log
|
||||
chatlog.create({
|
||||
const log = await chatlog.create({
|
||||
notification: true,
|
||||
username: socket.user.username,
|
||||
text: `${socket.user.username} left the room`,
|
||||
@@ -176,16 +173,16 @@ const executeCommand = (io, socket, command) => {
|
||||
emphasis: true
|
||||
});
|
||||
|
||||
//broadcast to the old room
|
||||
socket.broadcast.to(socket.user.room).emit('message', { timestamp: log.createdAt, emphasis: true, text: `${socket.user.username} left the room (going to ${room})` });
|
||||
|
||||
//move
|
||||
socket.leave(socket.user.room);
|
||||
socket.user.room = room;
|
||||
socket.join(socket.user.room);
|
||||
|
||||
//broadcast to the new room
|
||||
socket.broadcast.to(socket.user.room).emit('message', { emphasis: true, text: `${socket.user.username} entered the room` });
|
||||
|
||||
//log
|
||||
chatlog.create({
|
||||
const log = await chatlog.create({
|
||||
notification: true,
|
||||
username: socket.user.username,
|
||||
text: `${socket.user.username} entered the room`,
|
||||
@@ -193,6 +190,9 @@ const executeCommand = (io, socket, command) => {
|
||||
emphasis: true
|
||||
});
|
||||
|
||||
//broadcast to the new room
|
||||
socket.broadcast.to(socket.user.room).emit('message', {timestamp: log.createdAt, emphasis: true, text: `${socket.user.username} entered the room` });
|
||||
|
||||
//update the user
|
||||
socket.emit('message', {timestamp: log.createdAt, emphasis: true, text: `Entered room ${socket.user.room}` });
|
||||
break;
|
||||
@@ -224,12 +224,9 @@ const executeCommand = (io, socket, command) => {
|
||||
until: interval,
|
||||
reason: reason
|
||||
});
|
||||
|
||||
//broadcast
|
||||
io.to(socket.user.room).emit('message', { strong: true, emphasis: true, text: `${username} has been muted for ${minutes} minute${minutes != 1 ? 's' : ''}${reason ? ': ' : ''}${reason}` });
|
||||
|
||||
|
||||
//log
|
||||
chatlog.create({
|
||||
const log = await chatlog.create({
|
||||
notification: true,
|
||||
username: socket.user.username,
|
||||
text: `${username} has been muted for ${minutes} minute${minutes != 1 ? 's' : ''}: ${reason}`,
|
||||
@@ -238,6 +235,9 @@ const executeCommand = (io, socket, command) => {
|
||||
emphasis: true
|
||||
});
|
||||
|
||||
//broadcast
|
||||
io.to(socket.user.room).emit('message', { timestamp: log.createdAt, strong: true, emphasis: true, text: `${username} has been muted for ${minutes} minute${minutes != 1 ? 's' : ''}${reason ? ': ' : ''}${reason}` });
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -267,11 +267,8 @@ const executeCommand = (io, socket, command) => {
|
||||
break;
|
||||
}
|
||||
|
||||
//broadcast
|
||||
io.to(socket.user.room).emit('message', { emphasis: true, text: `${username} has been unmuted` });
|
||||
|
||||
//log
|
||||
chatlog.create({
|
||||
const log = await chatlog.create({
|
||||
notification: true,
|
||||
username: socket.user.username,
|
||||
text: `${username} has been unmuted`,
|
||||
@@ -279,6 +276,9 @@ const executeCommand = (io, socket, command) => {
|
||||
emphasis: true
|
||||
});
|
||||
|
||||
//broadcast
|
||||
io.to(socket.user.room).emit('message', {timestamp: log.createdAt, emphasis: true, text: `${username} has been unmuted` });
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user