Add quick mute buttons, fix delete not updating playlist meta

This commit is contained in:
calzoneman 2014-01-19 16:50:14 -06:00
parent cd73653451
commit 8c47221a22
3 changed files with 48 additions and 3 deletions

View File

@ -1765,6 +1765,7 @@ Channel.prototype.deleteMedia = function (uid, callback) {
self.sendAll("delete", {
uid: uid
});
self.updatePlaylistMeta();
self.sendPlaylistMeta(self.users);
callback(null);
} else {

View File

@ -528,7 +528,7 @@ Callbacks = {
return;
}
user.data("meta", data);
user.data("meta", data.meta);
if (data.meta.muted || data.meta.smuted) {
user.data("icon", "glyphicon-volume-off");
} else {
@ -586,7 +586,7 @@ Callbacks = {
},
setUserRank: function (data) {
var entries = $("#cs-chanranks table").data("entries");
var entries = $("#cs-chanranks table").data("entries") || [];
var found = false;
for (var i = 0; i < entries.length; i++) {
if (entries[i].name === data.name) {

View File

@ -159,7 +159,8 @@ function getNameColor(rank) {
function addUserDropdown(entry) {
var name = entry.data("name"),
rank = entry.data("rank"),
leader = entry.data("leader");
leader = entry.data("leader"),
meta = entry.data("meta") || {};
entry.find(".user-dropdown").remove();
var menu = $("<div/>")
.addClass("user-dropdown")
@ -222,6 +223,49 @@ function addUserDropdown(entry) {
.appendTo(btngroup);
}
/* mute buttons */
if (hasPermission("mute")) {
var mute = $("<button/>").addClass("btn btn-xs btn-default")
.text("Mute")
.click(function () {
socket.emit("chatMsg", {
msg: "/mute " + name
});
mute.hide();
smute.hide();
unmute.show();
})
.appendTo(btngroup);
var smute = $("<button/>").addClass("btn btn-xs btn-default")
.text("Shadow Mute")
.click(function () {
socket.emit("chatMsg", {
msg: "/smute " + name
});
mute.hide();
smute.hide();
unmute.show();
})
.appendTo(btngroup);
var unmute = $("<button/>").addClass("btn btn-xs btn-default")
.text("Unmute")
.click(function () {
socket.emit("chatMsg", {
msg: "/unmute " + name
});
unmute.hide();
mute.show();
smute.show();
})
.appendTo(btngroup);
if (meta.muted) {
mute.hide();
smute.hide();
} else {
unmute.hide();
}
}
/* ban buttons */
if(hasPermission("ban")) {
$("<button/>").addClass("btn btn-xs btn-default")