From a3596b7aaa69536b60e66934d26428327aa11ba7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Gully?= Date: Wed, 9 Jan 2013 23:11:07 +0100 Subject: [PATCH] fixes: after rm -rf server/data/* and one reload of the interface, a javascript error appears --- client/jquery.phpfreechat.core.js | 7 ++++--- server/routes/channels.php | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/client/jquery.phpfreechat.core.js b/client/jquery.phpfreechat.core.js index 3a8a0bb6..3bafc6c2 100644 --- a/client/jquery.phpfreechat.core.js +++ b/client/jquery.phpfreechat.core.js @@ -74,10 +74,11 @@ var phpFreeChat = (function (pfc, $, window, undefined) { // store userdata in the cache // refresh the interface pfc.clearUserList(); - $.each(cinfo.users, function (uid) { + $.each(cinfo.users, function (uid, udata) { pfc.channels[cid].users.push(uid); - pfc.users[uid] = cinfo.users[uid]; - pfc.appendUser(cinfo.users[uid]); + + pfc.users[uid] = udata; + pfc.appendUser(udata); }); // display a join message for him diff --git a/server/routes/channels.php b/server/routes/channels.php index e5967eb2..16573d5d 100644 --- a/server/routes/channels.php +++ b/server/routes/channels.php @@ -62,7 +62,10 @@ if (!Container_users::joinChannel($uid, $cid)) { $res->status(200); // User already joined the channel $res['Content-Type'] = 'application/json; charset=utf-8'; - $res->body(json_encode(Container_channels::getChannelUsers($cid, true))); + $res->body(json_encode(array( + 'users' => Container_channels::getChannelUsers($cid, true), + 'op' => Container_channels_op::getOpList($cid), + ))); return; } else { // post a join message