emoji_settings: Only allow admins to override default emoji.

Uptil now, any user could add a custom emoji with the same name as a
default emoji, thus overriding it (with a confirmation after warning).

To create more friction for this action, now only admins are allowed to
add custom emojis that override default ones. All users can still add
custom emojis with other names.

Fixes part of #24120.
This commit is contained in:
N-Shar-ma 2023-01-20 21:36:53 +05:30 committed by Tim Abbott
parent a4e477bf02
commit 8a5b71fdbd
1 changed files with 11 additions and 0 deletions

View File

@ -260,6 +260,17 @@ export function set_up() {
}
if (is_default_emoji(emoji.name)) {
if (!page_params.is_admin) {
ui_report.client_error(
$t_html({
defaultMessage:
"Failed: There is a default emoji with this name. Only administrators can override default emoji.",
}),
$emoji_status,
);
return;
}
const html_body = emoji_settings_warning_modal({
emoji_name: emoji.name,
});