|
@@ -131,21 +131,24 @@ class _APIModule extends CoreClass {
|
|
|
|
|
|
PlaylistsModule.runJob("GET_PLAYLIST", { playlistId })
|
|
PlaylistsModule.runJob("GET_PLAYLIST", { playlistId })
|
|
.then(playlist => {
|
|
.then(playlist => {
|
|
- if (playlist.privacy === "public")
|
|
|
|
- res.json({ status: "success", playlist });
|
|
|
|
|
|
+ if (playlist.privacy === "public") res.json({ status: "success", playlist });
|
|
else {
|
|
else {
|
|
isLoggedIn(req, res, () => {
|
|
isLoggedIn(req, res, () => {
|
|
- if (playlist.createdBy === req.session.userId)
|
|
|
|
|
|
+ if (playlist.createdBy === req.session.userId)
|
|
res.json({ status: "success", playlist });
|
|
res.json({ status: "success", playlist });
|
|
else {
|
|
else {
|
|
userModel.findOne({ _id: req.session.userId }, (err, user) => {
|
|
userModel.findOne({ _id: req.session.userId }, (err, user) => {
|
|
if (err) res.json({ status: "error", message: err.message });
|
|
if (err) res.json({ status: "error", message: err.message });
|
|
else if (user.role === "admin")
|
|
else if (user.role === "admin")
|
|
res.json({ status: "success", playlist });
|
|
res.json({ status: "success", playlist });
|
|
- else res.json({ status: "error", message: "You're not allowed to download this playlist." });
|
|
|
|
|
|
+ else
|
|
|
|
+ res.json({
|
|
|
|
+ status: "error",
|
|
|
|
+ message: "You're not allowed to download this playlist."
|
|
|
|
+ });
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- })
|
|
|
|
|
|
+ });
|
|
}
|
|
}
|
|
})
|
|
})
|
|
.catch(err => {
|
|
.catch(err => {
|