Ability to hide playlist
This commit is contained in:
parent
6292ca5f3f
commit
6e0f27f254
4 changed files with 33 additions and 5 deletions
|
|
@ -46,6 +46,7 @@ function Channel(name) {
|
|||
self.poll = null;
|
||||
self.voteskip = null;
|
||||
self.permissions = {
|
||||
seeplaylist: -1, // See the playlist
|
||||
playlistadd: 1.5, // Add video to the playlist
|
||||
playlistnext: 1.5,
|
||||
playlistmove: 1.5, // Move a video on the playlist
|
||||
|
|
@ -1062,10 +1063,12 @@ Channel.prototype.sendPlaylist = function (users) {
|
|||
}
|
||||
|
||||
users.forEach(function (u) {
|
||||
u.socket.emit("playlist", pl);
|
||||
u.socket.emit("setPlaylistMeta", self.plmeta);
|
||||
if (current !== null) {
|
||||
u.socket.emit("setCurrent", current);
|
||||
if (self.hasPermission(u, "seeplaylist")) {
|
||||
u.socket.emit("playlist", pl);
|
||||
u.socket.emit("setPlaylistMeta", self.plmeta);
|
||||
if (current !== null) {
|
||||
u.socket.emit("setCurrent", current);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
@ -1096,7 +1099,9 @@ Channel.prototype.updatePlaylistMeta = function () {
|
|||
Channel.prototype.sendPlaylistMeta = function (users) {
|
||||
var self = this;
|
||||
users.forEach(function (u) {
|
||||
u.socket.emit("setPlaylistMeta", self.plmeta);
|
||||
if (self.hasPermission(u, "seeplaylist")) {
|
||||
u.socket.emit("setPlaylistMeta", self.plmeta);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -2619,6 +2624,10 @@ Channel.prototype.handleSetPermissions = function (user, perms) {
|
|||
}
|
||||
}
|
||||
|
||||
if ("seeplaylist" in perms) {
|
||||
this.sendPlaylist(this.users);
|
||||
}
|
||||
|
||||
this.logger.log("[mod] " + user.name + " updated permissions");
|
||||
this.sendAll("setPermissions", this.permissions);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue