UX: warn about consequences of group deletion (#20030)

This adds the group member count, group name, and rewords the warning.

---------

Co-authored-by: Penar Musaraj <pmusaraj@gmail.com>
This commit is contained in:
Kris 2023-02-14 09:01:06 -05:00 committed by GitHub
parent 524cb5211b
commit dfffb43933
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 14 deletions

View File

@ -1 +1,20 @@
{{i18n "admin.groups.delete_with_messages_confirm" count=@model.message_count}}
{{#if @model.members.length}}
<p>
{{d-icon "users"}}
{{i18n "admin.groups.delete_details" count=@model.members.length}}
</p>
{{/if}}
{{#if @model.message_count}}
<p>
{{d-icon "envelope"}}
{{i18n
"admin.groups.delete_with_messages_confirm"
count=@model.message_count
}}
</p>
{{/if}}
<p>
{{d-icon "exclamation-triangle"}}
{{i18n "admin.groups.delete_warning"}}
</p>

View File

@ -138,16 +138,10 @@ export default Controller.extend({
this.set("destroying", true);
const model = this.model;
const title = I18n.t("admin.groups.delete_confirm");
let bodyComponent = null;
if (model.has_messages && model.message_count > 0) {
bodyComponent = GroupDeleteDialog;
}
this.dialog.deleteConfirm({
title,
bodyComponent,
title: I18n.t("admin.groups.delete_confirm", { group: model.name }),
bodyComponent: GroupDeleteDialog,
bodyComponentModel: model,
didConfirm: () => {
model

View File

@ -275,7 +275,7 @@ acceptance("Group - Authenticated", function (needs) {
await click(".group-details-button button.btn-danger");
assert.strictEqual(
query(".dialog-body").textContent.trim(),
query(".dialog-body p:nth-of-type(2)").textContent.trim(),
I18n.t("admin.groups.delete_with_messages_confirm", {
count: 2,
}),

View File

@ -426,7 +426,7 @@ module("Integration | Component | dialog-holder", function (hooks) {
await settled();
assert.strictEqual(
query(".dialog-body").innerText.trim(),
query(".dialog-body p:first-child").innerText.trim(),
I18n.t("admin.groups.delete_with_messages_confirm", {
count: message_count,
}),

View File

@ -4616,10 +4616,14 @@ en:
about: "Edit your group membership and names here"
group_members: "Group members"
delete: "Delete"
delete_confirm: "Are you sure you want to delete this group?"
delete_confirm: "Are you sure you want to delete %{group}?"
delete_details:
one: "%{count} person will lose access to this group"
other: "%{count} people will lose access to this group"
delete_with_messages_confirm:
one: "Deleting this group will cause %{count} message to be orphaned, group members will no longer have access to it."
other: "Deleting this group will cause %{count} messages to be orphaned, group members will no longer have access to them."
one: "%{count} message will become inaccessible to group members"
other: "%{count} messages will become inaccessible to group members"
delete_warning: "Deleted groups can not be recovered"
delete_failed: "Unable to delete group. If this is an automatic group, it cannot be destroyed."
delete_automatic_group: This is an automatic group and cannot be deleted.
delete_owner_confirm: "Remove owner privilege for '%{username}'?"