Fix bugs when anonymous uses member-only shortcuts
This commit is contained in:
@@ -20,6 +20,10 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
var open_favgroup_dialog = function(e) {
|
var open_favgroup_dialog = function(e) {
|
||||||
|
if (Danbooru.meta("current-user-id") == "") { // anonymous
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ($(".add-to-favgroup").length === 1) {
|
if ($(".add-to-favgroup").length === 1) {
|
||||||
// If the user only has one favorite group we don't need to ask which group to add the post to.
|
// If the user only has one favorite group we don't need to ask which group to add the post to.
|
||||||
$(".add-to-favgroup").click();
|
$(".add-to-favgroup").click();
|
||||||
|
|||||||
@@ -560,6 +560,11 @@ Danbooru.Note = {
|
|||||||
start: function(e) {
|
start: function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
if (Danbooru.meta("current-user-id") == "") {
|
||||||
|
Danbooru.notice("You must be logged in to edit notes");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (Danbooru.Note.TranslationMode.active) {
|
if (Danbooru.Note.TranslationMode.active) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -189,7 +189,11 @@
|
|||||||
if ($("#add-to-favorites").is(":visible")) {
|
if ($("#add-to-favorites").is(":visible")) {
|
||||||
$("#add-to-favorites").click();
|
$("#add-to-favorites").click();
|
||||||
} else {
|
} else {
|
||||||
Danbooru.notice("You have already favorited this post")
|
if (Danbooru.meta("current-user-id") == "") {
|
||||||
|
Danbooru.notice("You must be logged in to favorite posts");
|
||||||
|
} else {
|
||||||
|
Danbooru.notice("You have already favorited this post");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -17,6 +17,10 @@
|
|||||||
|
|
||||||
if ($("#image").length) { // post page or bookmarklet upload page
|
if ($("#image").length) { // post page or bookmarklet upload page
|
||||||
$(document).bind("keydown", "shift+e", function(e) {
|
$(document).bind("keydown", "shift+e", function(e) {
|
||||||
|
if (Danbooru.meta("current-user-id") == "") { // anonymous
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!$("#edit-dialog").length) {
|
if (!$("#edit-dialog").length) {
|
||||||
$("#edit").show();
|
$("#edit").show();
|
||||||
$("#comments").hide();
|
$("#comments").hide();
|
||||||
@@ -33,7 +37,9 @@
|
|||||||
|
|
||||||
if ($("#c-posts").length && $("#a-show").length) {
|
if ($("#c-posts").length && $("#a-show").length) {
|
||||||
$(document).bind("keydown", "shift+o", function(e) {
|
$(document).bind("keydown", "shift+o", function(e) {
|
||||||
Danbooru.Post.approve(Danbooru.meta("post-id"));
|
if (Danbooru.meta("current-user-can-approve-posts") === "true") {
|
||||||
|
Danbooru.Post.approve(Danbooru.meta("post-id"));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).bind("keydown", "r", function(e) {
|
$(document).bind("keydown", "r", function(e) {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
<%= csrf_meta_tag %>
|
<%= csrf_meta_tag %>
|
||||||
<meta name="current-user-name" content="<%= CurrentUser.name %>">
|
<meta name="current-user-name" content="<%= CurrentUser.name %>">
|
||||||
<meta name="current-user-id" content="<%= CurrentUser.id %>">
|
<meta name="current-user-id" content="<%= CurrentUser.id %>">
|
||||||
|
<meta name="current-user-can-approve-posts" content="<%= CurrentUser.can_approve_posts? %>">
|
||||||
<meta name="user-comment-threshold" content="<%= CurrentUser.comment_threshold %>">
|
<meta name="user-comment-threshold" content="<%= CurrentUser.comment_threshold %>">
|
||||||
<% if CurrentUser.user.blacklisted_tags.present? %>
|
<% if CurrentUser.user.blacklisted_tags.present? %>
|
||||||
<meta name="blacklisted-tags" content="<%= CurrentUser.user.blacklisted_tags.gsub(/(?:\r|\n)+/, ",") %>">
|
<meta name="blacklisted-tags" content="<%= CurrentUser.user.blacklisted_tags.gsub(/(?:\r|\n)+/, ",") %>">
|
||||||
|
|||||||
Reference in New Issue
Block a user