mirror of https://github.com/zulip/zulip.git
custom_emojis: Fix unresponsiveness after submitting without a name.
While adding custom emojis, when a user clicks on the submit button without providing a name to the emoji, the submit button becomes unresponsive. This commit fixes that. Fixes #16921
This commit is contained in:
parent
1498b2ef69
commit
b1f4c98730
|
@ -175,7 +175,6 @@ exports.set_up = function () {
|
|||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
const emoji_status = $("#admin-emoji-status");
|
||||
$("#admin_emoji_submit").prop("disabled", true);
|
||||
const emoji = {};
|
||||
const formData = new FormData();
|
||||
|
||||
|
@ -183,6 +182,16 @@ exports.set_up = function () {
|
|||
emoji[obj.name] = obj.value;
|
||||
}
|
||||
|
||||
if (emoji.name.trim() === "") {
|
||||
ui_report.message(
|
||||
i18n.t("Failed: Emoji name is required."),
|
||||
emoji_status,
|
||||
"alert-error",
|
||||
);
|
||||
return;
|
||||
}
|
||||
$("#admin_emoji_submit").prop("disabled", true);
|
||||
|
||||
for (const [i, file] of Array.prototype.entries.call($("#emoji_file_input")[0].files)) {
|
||||
formData.append("file-" + i, file);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue