If user isn't in chatroom menu, don't send chatroom events
This commit is contained in:
1 file changed
+16
-8
+16
-8
@@ -555,8 +555,10 @@ app.ws('/ws', {
|
|||||||
|
|
||||||
if (result[0].affectedRows == 1) {
|
if (result[0].affectedRows == 1) {
|
||||||
for (const client of clients) {
|
for (const client of clients) {
|
||||||
if (!clientInfo.some(clientInfo => clientInfo.Id === client.id))
|
const info = clientInfo.find(
|
||||||
return
|
clientInfo => clientInfo.Id === client.id
|
||||||
|
)
|
||||||
|
if (!info || info.SceneName != 'ChatroomMenu') continue
|
||||||
client.send(
|
client.send(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
for: message.type + ':' + message.kind,
|
for: message.type + ':' + message.kind,
|
||||||
@@ -632,8 +634,10 @@ app.ws('/ws', {
|
|||||||
|
|
||||||
if (!chatRows.reverse()[0])
|
if (!chatRows.reverse()[0])
|
||||||
for (const client of clients) {
|
for (const client of clients) {
|
||||||
if (!clientInfo.some(clientInfo => clientInfo.Id === client.id))
|
const info = clientInfo.find(
|
||||||
return
|
clientInfo => clientInfo.Id === client.id
|
||||||
|
)
|
||||||
|
if (!info || info.SceneName != 'ChatroomMenu') continue
|
||||||
client.send(
|
client.send(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
for: message.type + ':' + message.kind,
|
for: message.type + ':' + message.kind,
|
||||||
@@ -680,8 +684,10 @@ app.ws('/ws', {
|
|||||||
let savedata = JSON.parse(userData[0].saveData)
|
let savedata = JSON.parse(userData[0].saveData)
|
||||||
|
|
||||||
for (const client of clients) {
|
for (const client of clients) {
|
||||||
if (!clientInfo.some(clientInfo => clientInfo.Id === client.id))
|
const info = clientInfo.find(
|
||||||
return
|
clientInfo => clientInfo.Id === client.id
|
||||||
|
)
|
||||||
|
if (!info || info.SceneName != 'ChatroomMenu') continue
|
||||||
client.send(
|
client.send(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
for: message.type + ':' + message.kind,
|
for: message.type + ':' + message.kind,
|
||||||
@@ -787,8 +793,10 @@ app.ws('/ws', {
|
|||||||
let savedata = JSON.parse(userData[0].saveData)
|
let savedata = JSON.parse(userData[0].saveData)
|
||||||
|
|
||||||
for (const client of clients) {
|
for (const client of clients) {
|
||||||
if (!clientInfo.some(clientInfo => clientInfo.Id === client.id))
|
const info = clientInfo.find(
|
||||||
return
|
clientInfo => clientInfo.Id === client.id
|
||||||
|
)
|
||||||
|
if (!info || info.SceneName != 'ChatroomMenu') continue
|
||||||
client.send(
|
client.send(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
for: message.type + ':' + message.kind,
|
for: message.type + ':' + message.kind,
|
||||||
|
|||||||
Reference in new issue
Block a user