Fix #4663: Tag script mode sometimes adds "null" tag.
This commit is contained in:
@@ -151,7 +151,7 @@ PostModeMenu.click = function(e) {
|
||||
Post.tag(post_id, "upvote:me");
|
||||
} else if (s === "tag-script") {
|
||||
var current_script_id = localStorage.getItem("current_tag_script_id");
|
||||
var tag_script = localStorage.getItem("tag-script-" + current_script_id);
|
||||
var tag_script = localStorage.getItem("tag-script-" + current_script_id) ?? "";
|
||||
Post.tag(post_id, tag_script);
|
||||
} else {
|
||||
return;
|
||||
|
||||
@@ -444,6 +444,7 @@ Post.show_pending_update_notice = function() {
|
||||
}
|
||||
|
||||
Post.tag = function(post_id, tags) {
|
||||
tags ??= "";
|
||||
const tag_string = (Array.isArray(tags) ? tags.join(" ") : String(tags));
|
||||
Post.update(post_id, "tag-script", { post: { old_tag_string: "", tag_string: tag_string }});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user