mirror of https://github.com/zulip/zulip.git
user_profile: Disable deactivate user button if the admin is only user.
This commit disables the "Deactivate User" button inside the "manage user" tab in the user profile modal. Additionally, a tooltip is applied to the button by wrapping it inside a div with the tooltip applied.
This commit is contained in:
parent
c2f878638b
commit
6323bb1e39
|
@ -657,6 +657,7 @@ export function show_edit_user_info_modal(user_id, $container) {
|
|||
full_name: person.full_name,
|
||||
user_role_values: settings_config.user_role_values,
|
||||
disable_role_dropdown: person.is_owner && !page_params.is_owner,
|
||||
owner_is_only_user_in_organization: people.get_active_human_count() === 1,
|
||||
});
|
||||
|
||||
$container.append(html_body);
|
||||
|
|
|
@ -303,7 +303,10 @@ export function initialize() {
|
|||
});
|
||||
|
||||
delegate("body", {
|
||||
target: ["#deactivate_account_container.disabled_setting_tooltip"],
|
||||
target: [
|
||||
"#deactivate_account_container.disabled_setting_tooltip",
|
||||
"#edit-user-form .deactivate_user_button_tooltip",
|
||||
],
|
||||
content: $t({
|
||||
defaultMessage:
|
||||
"Because you are the only organization owner, you cannot deactivate your account.",
|
||||
|
|
|
@ -27,8 +27,10 @@
|
|||
<div class="custom-profile-field-form"></div>
|
||||
</form>
|
||||
<div class="input-group new-style">
|
||||
<button class="button rounded btn-danger deactivate_user_button">
|
||||
{{t 'Deactivate user' }}
|
||||
</button>
|
||||
<span {{#if owner_is_only_user_in_organization}}class="deactivate_user_button_tooltip"{{/if}}>
|
||||
<button class="button rounded btn-danger deactivate_user_button" {{#if owner_is_only_user_in_organization}}disabled="disabled"{{/if}}>
|
||||
{{t 'Deactivate user' }}
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue