mirror of https://github.com/calzoneman/sync.git
Add quick mute buttons, fix delete not updating playlist meta
This commit is contained in:
parent
cd73653451
commit
8c47221a22
|
@ -1765,6 +1765,7 @@ Channel.prototype.deleteMedia = function (uid, callback) {
|
||||||
self.sendAll("delete", {
|
self.sendAll("delete", {
|
||||||
uid: uid
|
uid: uid
|
||||||
});
|
});
|
||||||
|
self.updatePlaylistMeta();
|
||||||
self.sendPlaylistMeta(self.users);
|
self.sendPlaylistMeta(self.users);
|
||||||
callback(null);
|
callback(null);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -528,7 +528,7 @@ Callbacks = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
user.data("meta", data);
|
user.data("meta", data.meta);
|
||||||
if (data.meta.muted || data.meta.smuted) {
|
if (data.meta.muted || data.meta.smuted) {
|
||||||
user.data("icon", "glyphicon-volume-off");
|
user.data("icon", "glyphicon-volume-off");
|
||||||
} else {
|
} else {
|
||||||
|
@ -586,7 +586,7 @@ Callbacks = {
|
||||||
},
|
},
|
||||||
|
|
||||||
setUserRank: function (data) {
|
setUserRank: function (data) {
|
||||||
var entries = $("#cs-chanranks table").data("entries");
|
var entries = $("#cs-chanranks table").data("entries") || [];
|
||||||
var found = false;
|
var found = false;
|
||||||
for (var i = 0; i < entries.length; i++) {
|
for (var i = 0; i < entries.length; i++) {
|
||||||
if (entries[i].name === data.name) {
|
if (entries[i].name === data.name) {
|
||||||
|
|
|
@ -159,7 +159,8 @@ function getNameColor(rank) {
|
||||||
function addUserDropdown(entry) {
|
function addUserDropdown(entry) {
|
||||||
var name = entry.data("name"),
|
var name = entry.data("name"),
|
||||||
rank = entry.data("rank"),
|
rank = entry.data("rank"),
|
||||||
leader = entry.data("leader");
|
leader = entry.data("leader"),
|
||||||
|
meta = entry.data("meta") || {};
|
||||||
entry.find(".user-dropdown").remove();
|
entry.find(".user-dropdown").remove();
|
||||||
var menu = $("<div/>")
|
var menu = $("<div/>")
|
||||||
.addClass("user-dropdown")
|
.addClass("user-dropdown")
|
||||||
|
@ -222,6 +223,49 @@ function addUserDropdown(entry) {
|
||||||
.appendTo(btngroup);
|
.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 */
|
/* ban buttons */
|
||||||
if(hasPermission("ban")) {
|
if(hasPermission("ban")) {
|
||||||
$("<button/>").addClass("btn btn-xs btn-default")
|
$("<button/>").addClass("btn btn-xs btn-default")
|
||||||
|
|
Loading…
Reference in New Issue