projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix targetted challenge deletion after refusal
[vchess.git]
/
client
/
src
/
views
/
Hall.vue
diff --git
a/client/src/views/Hall.vue
b/client/src/views/Hall.vue
index
83de5a4
..
5cbe0c8
100644
(file)
--- a/
client/src/views/Hall.vue
+++ b/
client/src/views/Hall.vue
@@
-254,7
+254,7
@@
export default {
let names = {};
response.challenges.forEach(c => {
if (c.uid != this.st.user.id) names[c.uid] = "";
let names = {};
response.challenges.forEach(c => {
if (c.uid != this.st.user.id) names[c.uid] = "";
- else if (
!!
c.target && c.target != this.st.user.id)
+ else if (c.target && c.target != this.st.user.id)
names[c.target] = "";
});
const addChallenges = () => {
names[c.target] = "";
});
const addChallenges = () => {
@@
-476,7
+476,10
@@
export default {
// Disconnect means no more tmpIds:
if (data.code == "disconnect") {
// Remove the live challenge sent by this player:
// Disconnect means no more tmpIds:
if (data.code == "disconnect") {
// Remove the live challenge sent by this player:
- ArrayFun.remove(this.challenges, c => c.from.sid == data.from);
+ ArrayFun.remove(
+ this.challenges,
+ c => c.type == "live" && c.from.sid == data.from
+ );
} else {
// Remove the matching live game if now unreachable
const gid = data.page.match(/[a-zA-Z0-9]+$/)[0];
} else {
// Remove the matching live game if now unreachable
const gid = data.page.match(/[a-zA-Z0-9]+$/)[0];
@@
-807,8
+810,10
@@
export default {
this.launchGame(c);
} else {
const oppsid = this.getOppsid(c);
this.launchGame(c);
} else {
const oppsid = this.getOppsid(c);
- if (opp
S
id)
+ if (opp
s
id)
this.send("refusechallenge", { data: c.id, target: oppsid });
this.send("refusechallenge", { data: c.id, target: oppsid });
+ if (c.type == "corr")
+ ajax("/challenges", "DELETE", { id: c.id });
}
this.send("deletechallenge", { data: c.id });
},
}
this.send("deletechallenge", { data: c.id });
},
@@
-847,9
+852,8
@@
export default {
}
else {
// My challenge
}
else {
// My challenge
- if (c.type == "corr")
{
+ if (c.type == "corr")
ajax("/challenges", "DELETE", { id: c.id });
ajax("/challenges", "DELETE", { id: c.id });
- }
this.send("deletechallenge", { data: c.id });
}
// In all cases, the challenge is consumed:
this.send("deletechallenge", { data: c.id });
}
// In all cases, the challenge is consumed: