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) {
|
||||||
add_message(data);
|
// make sure user is still in the same room
|
||||||
callback(true);
|
if (room == window.room_id) {
|
||||||
|
add_message(data);
|
||||||
|
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