settings ui: Hide buttons to add/delete organization logo for nonadmins.

Users are unable to modify organization's logos, but disabled
buttons for the same are being shown to the user on the organization
settings page. This commit removes those buttons. The file
realm-logo-widget.hbs renders those buttons only if the user is an
admin and realm_logo.js has been updated to allow operations
(like click) on the buttons only to admins.
This commit is contained in:
Pranav 2020-03-29 00:58:14 +05:30 committed by Tim Abbott
parent ffc32ef795
commit d91d32adfc
2 changed files with 6 additions and 0 deletions

View File

@ -13,6 +13,10 @@ exports.build_realm_logo_widget = function (upload_function, is_night) {
return file_input_elem.expectOne(); return file_input_elem.expectOne();
}; };
if (!page_params.is_admin) {
return;
}
if (page_params.realm_logo_source === 'D') { if (page_params.realm_logo_source === 'D') {
delete_button_elem.hide(); delete_button_elem.hide();
} else { } else {

View File

@ -4,6 +4,7 @@
<input type="file" name="realm-logo-file-input" <input type="file" name="realm-logo-file-input"
class="realm-logo-file-input notvisible" value="{{t 'Upload logo' }}"/> class="realm-logo-file-input notvisible" value="{{t 'Upload logo' }}"/>
</div> </div>
{{#if is_admin}}
<div class="inline-block avatar-controls"> <div class="inline-block avatar-controls">
<div class="realm-logo-file-input-error alert text-error"></div> <div class="realm-logo-file-input-error alert text-error"></div>
{{#if plan_includes_wide_organization_logo}} {{#if plan_includes_wide_organization_logo}}
@ -16,4 +17,5 @@
</button> </button>
{{/if}} {{/if}}
</div> </div>
{{/if}}
</div> </div>