Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
settings_emoji: Improve error handling for uploading custom emojis.
aryanshridhar2d8fceff5de2
diff --git a/static/js/settings_emoji.js b/static/js/settings_emoji.jsindex 5361f831a99..1b2816dd650 100644--- a/static/js/settings_emoji.js+++ b/static/js/settings_emoji.js@@ -81,6 +81,16 @@ function is_default_emoji(emoji_name) {return emoji_codes.names.includes(emoji_name);}+function is_custom_emoji(emoji_name) {+ const emoji_data = emoji.get_server_realm_emoji_data();+ for (const emoji of Object.values(emoji_data)) {+ if (emoji.name === emoji_name && !emoji.deactivated) {+ return true;+ }+ }+ return false;+}+export function populate_emoji() {if (!meta.loaded) {return;@@ -239,6 +249,16 @@ export function set_up() {return;}+ if (is_custom_emoji(emoji.name)) {+ ui_report.client_error(+ $t_html({+ defaultMessage: "Failed: A custom emoji with this name already exists.",+ }),+ emoji_status,+ );+ return;+ }+if (is_default_emoji(emoji.name)) {const modal_parent = $("#settings_content");const html_body = emoji_settings_warning_modal({