settings: Disable organization deactivation button for admins.

This commit adds the code to disable deactivate organization button
for admins. We now allow only owners to deactivate the organization.

The backend implementation for allowing only owners to deactivate
is already added in 81c28c1.
This commit is contained in:
sahil839 2020-06-11 16:56:27 +05:30 committed by Tim Abbott
parent dbd64c4362
commit a6f31c3668
3 changed files with 10 additions and 1 deletions

View File

@ -14,7 +14,12 @@ exports.reset = function () {
exports.maybe_disable_widgets = function () {
if (page_params.is_owner) {
return;
}
if (page_params.is_admin) {
$("#deactivate_realm_button").attr("disabled", true);
return;
}

View File

@ -56,6 +56,7 @@ exports.update_person = function update(person) {
if (people.is_my_user_id(person.user_id) && page_params.is_owner !== person_obj.is_owner) {
page_params.is_owner = person_obj.is_owner;
settings_org.maybe_disable_widgets();
}
if (people.is_my_user_id(person.user_id) && page_params.is_admin !== person_obj.is_admin) {

View File

@ -74,7 +74,10 @@
theme_mode="night"
logo_url=realm_night_logo_url}}
<h3 class="light">{{t "Deactivate organization" }}</h3>
<h3 class="light">
{{t "Deactivate organization" }}
<i class="fa fa-info-circle settings-info-icon realm_allow_message_deleting_tooltip" data-toggle="tooltip" aria-hidden="true" title="{{t 'Only owners can deactivate the organization.' }}"></i>
</h3>
<div class="deactivate-realm-section">
<div class="input-group">
<button class="button rounded btn-danger" id="deactivate_realm_button">