« get me outta code hell

actually set hasAnnouncedJoin on server lol - mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <towerofnix@gmail.com>2021-04-25 10:36:16 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-05-16 22:00:54 -0300
commit65797c65bc1d3c98bd16ad4c2c0f1e486b9ebe49 (patch)
treee7244c6d119f8145cea5a0b465dfb0fea63feeda
parent897673852bac805c9c7a129ffc426ad27e0d9b3e (diff)
actually set hasAnnouncedJoin on server lol
-rw-r--r--socket.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/socket.js b/socket.js
index 1e25e6c..e6ebc57 100644
--- a/socket.js
+++ b/socket.js
@@ -372,10 +372,17 @@ export function makeSocketServer() {
         nickname = command.nickname
       }
 
-      // If the socket hasn't announced its joining yet - and this isn't the
-      // command where it does so - don't relay the command.
+      // If it's an 'announce-join' command, mark the variable for this!
 
-      if (!hasAnnouncedJoin && command.code !== 'announce-join') {
+      if (command.code === 'announce-join') {
+        hasAnnouncedJoin = true;
+      }
+
+      // If the socket hasn't announced its joining yet, don't relay the
+      // command. (Since hasAnnouncedJoin gets set above, 'announce-join'
+      // will meet this condition.)
+
+      if (!hasAnnouncedJoin) {
         return
       }