projects
/
vchess.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
af041c9
)
Fixed corr challenge refused bug
author
Benjamin Auder
<benjamin.auder@somewhere>
Wed, 4 Mar 2020 21:55:17 +0000
(22:55 +0100)
committer
Benjamin Auder
<benjamin.auder@somewhere>
Wed, 4 Mar 2020 21:55:17 +0000
(22:55 +0100)
client/src/views/Hall.vue
patch
|
blob
|
blame
|
history
diff --git
a/client/src/views/Hall.vue
b/client/src/views/Hall.vue
index
7c3a442
..
83de5a4
100644
(file)
--- a/
client/src/views/Hall.vue
+++ b/
client/src/views/Hall.vue
@@
-407,6
+407,15
@@
export default {
processChat: function(chat) {
this.send("newchat", { data: chat });
},
processChat: function(chat) {
this.send("newchat", { data: chat });
},
+ getOppsid: function(c) {
+ let oppsid = c.from.sid; //may not be defined if corr + offline opp
+ if (!oppsid) {
+ oppsid = Object.keys(this.people).find(
+ sid => this.people[sid].id == c.from.id
+ );
+ }
+ return oppsid;
+ },
// Messaging center:
socketMessageListener: function(msg) {
if (!this.conn) return;
// Messaging center:
socketMessageListener: function(msg) {
if (!this.conn) return;
@@
-797,10
+806,9
@@
export default {
};
this.launchGame(c);
} else {
};
this.launchGame(c);
} else {
-
-console.log(c);
-
- this.send("refusechallenge", { data: c.id, target: c.from.sid });
+ const oppsid = this.getOppsid(c);
+ if (oppSid)
+ this.send("refusechallenge", { data: c.id, target: oppsid });
}
this.send("deletechallenge", { data: c.id });
},
}
this.send("deletechallenge", { data: c.id });
},
@@
-860,13
+868,8
@@
console.log(c);
vid: c.vid,
cadence: c.cadence
};
vid: c.vid,
cadence: c.cadence
};
- let oppsid = c.from.sid; //may not be defined if corr + offline opp
- if (!oppsid) {
- oppsid = Object.keys(this.people).find(
- sid => this.people[sid].id == c.from.id
- );
- }
const notifyNewgame = () => {
const notifyNewgame = () => {
+ const oppsid = this.getOppsid(c);
if (oppsid)
//opponent is online
this.send("startgame", { data: gameInfo, target: oppsid });
if (oppsid)
//opponent is online
this.send("startgame", { data: gameInfo, target: oppsid });