From 89422c3c1da0cd8d1657a84386ab5512f05cf832 Mon Sep 17 00:00:00 2001 From: calzoneman Date: Thu, 3 Oct 2013 22:07:44 -0500 Subject: [PATCH] Fix #289 --- changelog | 4 ++++ lib/channel.js | 13 +++++++++++-- lib/playlist.js | 9 ++++----- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/changelog b/changelog index bfb368eb..f2f7c298 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,7 @@ +Thu Oct 03 22:05 2013 CDT + * lib/channel.js, lib/playlist.js: Fix 'next' bumping not properly + telling clients that the old item was deleted + Wed Oct 02 22:25 2013 CDT * www/channel.html, www/assets/js/ui.js, www/assets/js/callbacks.js: Add a small toggle for the MOTD diff --git a/lib/channel.js b/lib/channel.js index 224a94b1..089a0006 100644 --- a/lib/channel.js +++ b/lib/channel.js @@ -1057,9 +1057,9 @@ Channel.prototype.broadcastNewUser = function(user) { // If the channel is empty and isn't registered, the first person // gets ownership of the channel (temporarily) if(self.dbloaded && self.users.length == 1 && !self.registered) { - user.rank = (user.rank < Rank.Owner) ? 10 : user.rank; + user.rank = (user.rank < 10) ? 10 : user.rank; user.socket.emit("channelNotRegistered"); - user.socket.emit("rank", 10); + user.socket.emit("rank", user.rank); } self.server.db.listAliases(user.ip, function (err, aliases) { if(err) { @@ -1432,6 +1432,15 @@ Channel.prototype.addMedia = function(data, user) { q.release(); }; + // Pre-cached data (e.g. from a playlist) + if (typeof data.title === "string" && data.type !== "cu") { + self.plqueue.queue(function (q) { + var m = new Media(data.id, data.title, data.seconds, data.type); + afterData.bind(self, q, false)(m); + }); + return; + } + // special case for youtube playlists if (data.type === "yp") { self.plqueue.queue(function (q) { diff --git a/lib/playlist.js b/lib/playlist.js index e8ff7772..fe5154bf 100644 --- a/lib/playlist.js +++ b/lib/playlist.js @@ -169,12 +169,11 @@ Playlist.prototype.add = function(item, pos) { return "This item is already on the playlist"; } - self.remove(it.uid, function () { - self.channel.sendAll("delete", { - uid: it.uid - }); - self.channel.broadcastPlaylistMeta(); + self.remove(it.uid); + self.channel.sendAll("delete", { + uid: it.uid }); + self.channel.broadcastPlaylistMeta(); } if(pos == "append") {