Fix 'challenge' option for anonymous
[vchess.git] / client / src / views / Hall.vue
index 1031e49..eb8b681 100644 (file)
@@ -370,9 +370,9 @@ export default {
       return this.people[sid].pages.some(p => p.indexOf("/game/") >= 0);
     },
     getActionLabel: function(sid) {
-      return this.people[sid].pages.some(p => p == "/")
-        ? "Challenge"
-        : "Observe";
+      return this.people[sid].pages.some(p => p == "/game/")
+        ? "Observe"
+        : "Challenge";
     },
     challOrWatch: function(sid) {
       if (this.people[sid].pages.some(p => p == "/")) {
@@ -600,7 +600,8 @@ export default {
           // NOTE: it may be live or correspondance
           const game = data.data;
           // Ignore games where I play (corr games)
-          if (game.players.every(p => p.id != this.st.user.id))
+          if (game.players.every(p =>
+            p.sid != this.st.user.sid || p.id != this.st.user.id))
           {
             let locGame = this.games.find(g => g.id == game.id);
             if (!locGame) {