settings: Fix settings UI indicators for guest users.

This correctly shows guest users that they cannot interact with
anything in the "Organization" tab, though we preserve the read-only
access to it so that they can (e.g.) browse the organization's custom
emoji.
This commit is contained in:
Tim Abbott 2018-12-05 17:39:00 -08:00
parent 950d592279
commit cc54dddd84
3 changed files with 17 additions and 7 deletions

View File

@ -1,8 +1,6 @@
<div id="emoji-settings" data-name="emoji-settings" class="settings-section {{#if can_add_emojis}}can-edit{{/if}}">
<div class="emoji-settings-tip-container">
{{#unless is_guest}}
{{partial "emoji-settings-tip"}}
{{/unless}}
</div>
<form class="form-horizontal admin-emoji-form {{#unless can_add_emojis}}hide{{/unless}}">
<div class="add-new-emoji-box grey-box">

View File

@ -1,5 +1,9 @@
{{#if realm_add_emoji_by_admins_only}}
<div class='tip'>{{t "Only organization administrators can add custom emoji in this organization." }}</div>
{{#if is_guest}}
<div class='tip'>{{t "Guest users cannot edit custom emoji." }}</div>
{{else}}
<div class='tip'>{{t "Anyone in this organization can add custom emoji." }}</div>
{{#if realm_add_emoji_by_admins_only}}
<div class='tip'>{{t "Only organization administrators can add custom emoji in this organization." }}</div>
{{else}}
<div class='tip'>{{t "Any member of this organization can add custom emoji." }}</div>
{{/if}}
{{/if}}

View File

@ -68,13 +68,21 @@
<li tabindex="0" data-section="emoji-settings">
<i class="icon fa fa-smile-o" aria-hidden="true"></i>
<div class="text">{{ _('Custom emoji') }}</div>
{% if not is_admin and user_profile.realm.add_emoji_by_admins_only %}
<i class="locked fa fa-lock" title="{{ _('Only organization administrators can edit these settings.') }}"></i>
{% if is_guest %}
<i class="locked fa fa-lock" title="{{ _('Guest users cannot edit custom emoji.') }}"></i>
{% else %}
{% if not is_admin and user_profile.realm.add_emoji_by_admins_only %}
<i class="locked fa fa-lock" title="{{ _('Only organization administrators can edit these settings.') }}"></i>
{% endif %}
{% endif %}
</li>
<li tabindex="0" data-section="user-groups-admin">
<i class="icon fa fa-group" aria-hidden="true"></i>
<div class="text">{{ _('User groups') }}</div>
{% if is_guest %}
<i class="locked fa fa-lock"
title="{{ _('Only group members and organization administrators can modify a group.') }}"></i>
{% endif %}
</li>
<li tabindex="0" data-section="auth-methods">
<i class="icon fa fa-lock" aria-hidden="true"></i>