Fix race condition in chat
This commit is contained in:
parent
7406d081aa
commit
8cd7327d20
1 changed files with 5 additions and 2 deletions
|
@ -141,8 +141,11 @@
|
||||||
message: message,
|
message: message,
|
||||||
},
|
},
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
|
// make sure user is still in the same room
|
||||||
|
if (room == window.room_id) {
|
||||||
add_message(data);
|
add_message(data);
|
||||||
callback(true);
|
callback(true);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
error: function (data) {
|
error: function (data) {
|
||||||
console.log('Could not add new message');
|
console.log('Could not add new message');
|
||||||
|
|
Loading…
Reference in a new issue