Fix: don't search channel library if rank < seeplaylist
This commit is contained in:
parent
bc3f20198c
commit
71114b0060
|
@ -77,7 +77,8 @@ LibraryModule.prototype.handleSearchMedia = function (user, data) {
|
|||
});
|
||||
};
|
||||
|
||||
if (data.source === "yt" || !this.channel.is(Flags.C_REGISTERED)) {
|
||||
if (data.source === "yt" || !this.channel.is(Flags.C_REGISTERED) ||
|
||||
!this.channel.modules.permissions.canSeePlaylist(user)) {
|
||||
searchYT();
|
||||
} else {
|
||||
db.channels.searchLibrary(this.channel.name, query, function (err, res) {
|
||||
|
|
|
@ -13,8 +13,8 @@ html(lang="en")
|
|||
- var cname = "/r/" + channelName
|
||||
ul.nav.navbar-nav
|
||||
mixin navdefaultlinks(cname)
|
||||
li: a(href="#", onclick="javascript:showUserOptions()") Options
|
||||
li: a#showchansettings(href="#", onclick="javascript:$('#channeloptions').modal()") Channel Settings
|
||||
li: a(href="javascript:void(0)", onclick="javascript:showUserOptions()") Options
|
||||
li: a#showchansettings(href="javascript:void(0)", onclick="javascript:$('#channeloptions').modal()") Channel Settings
|
||||
li.dropdown
|
||||
a.dropdown-toggle(href="#", data-toggle="dropdown") Layout
|
||||
b.caret
|
||||
|
|
18
www/js/ui.js
18
www/js/ui.js
|
@ -242,6 +242,15 @@ $("#newpollbtn").click(showPollMenu);
|
|||
|
||||
/* search controls */
|
||||
$("#library_search").click(function() {
|
||||
if (!hasPermission("seeplaylist")) {
|
||||
$("#searchcontrol .alert").remove();
|
||||
var al = makeAlert("Permission Denied",
|
||||
"This channel does not allow you to search its library",
|
||||
"alert-danger");
|
||||
al.find(".alert").insertAfter($("#library_query").parent());
|
||||
return;
|
||||
}
|
||||
|
||||
socket.emit("searchMedia", {
|
||||
source: "library",
|
||||
query: $("#library_query").val().toLowerCase()
|
||||
|
@ -250,6 +259,15 @@ $("#library_search").click(function() {
|
|||
|
||||
$("#library_query").keydown(function(ev) {
|
||||
if(ev.keyCode == 13) {
|
||||
if (!hasPermission("seeplaylist")) {
|
||||
$("#searchcontrol .alert").remove();
|
||||
var al = makeAlert("Permission Denied",
|
||||
"This channel does not allow you to search its library",
|
||||
"alert-danger");
|
||||
al.find(".alert").insertAfter($("#library_query").parent());
|
||||
return;
|
||||
}
|
||||
|
||||
socket.emit("searchMedia", {
|
||||
source: "library",
|
||||
query: $("#library_query").val().toLowerCase()
|
||||
|
|
|
@ -914,6 +914,7 @@ function handlePermissionChange() {
|
|||
setVisible("#plmeta", hasPermission("seeplaylist"));
|
||||
$("#getplaylist").attr("disabled", !hasPermission("seeplaylist"));
|
||||
|
||||
setVisible("#showplaylistmanager", hasPermission("seeplaylist"));
|
||||
setVisible("#showmediaurl", hasPermission("playlistadd"));
|
||||
setVisible("#showcustomembed", hasPermission("playlistaddcustom"));
|
||||
$("#queue_next").attr("disabled", !hasPermission("playlistnext"));
|
||||
|
|
Loading…
Reference in a new issue