Start working on channel detail view

This commit is contained in:
Calvin Montgomery 2014-05-23 22:40:35 -07:00
parent ecc5ffc7da
commit 02ac983fba
4 changed files with 87 additions and 7 deletions

View file

@ -261,7 +261,7 @@ function handleDeleteChannel(user, data) {
}
function handleListActiveChannels(user) {
user.socket.emit("acp-list-activechannels", Server.getServer().packChannelList(false));
user.socket.emit("acp-list-activechannels", Server.getServer().packChannelList(false, true));
}
function handleForceUnload(user, data) {

View file

@ -194,7 +194,7 @@ Server.prototype.unloadChannel = function (chan) {
chan.dead = true;
};
Server.prototype.packChannelList = function (publicOnly) {
Server.prototype.packChannelList = function (publicOnly, showMeta) {
var channels = this.channels.filter(function (c) {
if (!publicOnly) {
return true;
@ -203,10 +203,13 @@ Server.prototype.packChannelList = function (publicOnly) {
return c.modules.options && c.modules.options.get("show_public");
});
return channels.map(this.packChannel.bind(this));
var self = this;
return channels.map(function (c) {
return self.packChannel(c, showMeta);
});
};
Server.prototype.packChannel = function (c) {
Server.prototype.packChannel = function (c, showMeta) {
var opts = c.modules.options;
var pl = c.modules.playlist;
var chat = c.modules.chat;
@ -238,6 +241,11 @@ Server.prototype.packChannel = function (c) {
}
}
/* Add in some extra data- intended to be site admin only */
if (showMeta) {
data.activeLockCount = c.activeLock.count;
}
return data;
};