settings: Update tooltip on lock icon shown for custom emoji panel.

This commit updates the tooltip for icon shown for custom emoji panel
to change the text to "You do not have permission to add custom emoji"
instead of just mentioning always that only admins can add them
even when we have other options like "Admins and moderators".

This also fixes the condition of showing or hiding the lock icon
to use the correct setting value and not the old setting
add_emoji_by_admins_only.
This commit is contained in:
Sahil Batra 2023-10-10 20:15:05 +05:30 committed by Tim Abbott
parent 50c80c6ff9
commit 17e0b6621b
2 changed files with 3 additions and 6 deletions

View File

@ -165,8 +165,7 @@ export function initialize() {
is_admin: page_params.is_admin, is_admin: page_params.is_admin,
is_guest: page_params.is_guest, is_guest: page_params.is_guest,
show_uploaded_files_section: page_params.max_file_upload_size_mib > 0, show_uploaded_files_section: page_params.max_file_upload_size_mib > 0,
show_emoji_settings_lock: show_emoji_settings_lock: !settings_data.user_can_add_custom_emoji(),
!page_params.is_admin && page_params.realm_add_emoji_by_admins_only,
can_create_new_bots: settings_bots.can_create_new_bots(), can_create_new_bots: settings_bots.can_create_new_bots(),
}); });
$("#settings_overlay_container").append(rendered_settings_overlay); $("#settings_overlay_container").append(rendered_settings_overlay);

View File

@ -79,10 +79,8 @@
<li tabindex="0" data-section="emoji-settings"> <li tabindex="0" data-section="emoji-settings">
<i class="icon fa fa-smile-o" aria-hidden="true"></i> <i class="icon fa fa-smile-o" aria-hidden="true"></i>
<div class="text">{{t "Custom emoji" }}</div> <div class="text">{{t "Custom emoji" }}</div>
{{#if is_guest}} {{#if show_emoji_settings_lock}}
<i class="locked fa fa-lock" title="{{t 'Guest users cannot edit custom emoji.' }}"></i> <i class="locked fa fa-lock" title="{{t 'You do not have permission to add custom emoji.'}}"></i>
{{else if show_emoji_settings_lock}}
<i class="locked fa fa-lock" title="{{t 'Only organization administrators can edit these settings.'}}"></i>
{{/if}} {{/if}}
</li> </li>
<li tabindex="0" data-section="linkifier-settings"> <li tabindex="0" data-section="linkifier-settings">