[Posts] Fix mode menu add/remove from set alerts (#707)

The "Updating post (# pending)" alert was being replaced with the "Added/Removed post from set", which is unhelpful.
This commit is contained in:
Cinder 2024-08-04 14:05:17 -07:00 committed by GitHub
parent 237f79eabe
commit e436458d66
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

View File

@ -181,9 +181,9 @@ PostModeMenu.click = function (e) {
} else if (s === "vote-up") {
Post.vote(post_id, 1, true);
} else if (s === "add-to-set") {
PostSet.add_post($("#set-id").val(), post_id);
PostSet.add_post($("#set-id").val(), post_id, true);
} else if (s === "remove-from-set") {
PostSet.remove_post($("#set-id").val(), post_id);
PostSet.remove_post($("#set-id").val(), post_id, true);
} else if (s === "rating-q") {
Post.update(post_id, {"post[rating]": "q"});
} else if (s === "rating-s") {

View File

@ -6,7 +6,7 @@ let PostSet = {};
PostSet.dialog_setup = false;
PostSet.add_post = function (set_id, post_id) {
PostSet.add_post = function (set_id, post_id, silent = false) {
if (!set_id) {
$(window).trigger("danbooru:error", "Error: No set specified");
return;
@ -25,12 +25,13 @@ PostSet.add_post = function (set_id, post_id) {
$(window).trigger("danbooru:error", "Error: " + message);
}).done(function () {
Post.notice_update("dec");
if (silent) return;
$(window).trigger("danbooru:notice", "Added post to set");
});
});
};
PostSet.remove_post = function (set_id, post_id) {
PostSet.remove_post = function (set_id, post_id, silent = false) {
if (!set_id) {
$(window).trigger("danbooru:error", "Error: No set specified");
return;
@ -48,6 +49,7 @@ PostSet.remove_post = function (set_id, post_id) {
$(window).trigger("danbooru:error", "Error: " + message);
}).done(function () {
Post.notice_update("dec");
if (silent) return;
$(window).trigger("danbooru:notice", "Removed post from set");
});
});