diff --git a/templates/chat/chat_js.html b/templates/chat/chat_js.html index e98517f..4180638 100644 --- a/templates/chat/chat_js.html +++ b/templates/chat/chat_js.html @@ -141,8 +141,11 @@ message: message, }, success: function (data) { - add_message(data); - callback(true); + // make sure user is still in the same room + if (room == window.room_id) { + add_message(data); + callback(true); + } }, error: function (data) { console.log('Could not add new message');