Merge pull request #3984 from tylershuster/group-delete

groups: only prompt to delete on ownership
This commit is contained in:
matildepark 2020-11-23 20:13:37 -05:00 committed by GitHub
commit daa08c5bad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,10 +34,12 @@ function DeleteGroup(props: {
const history = useHistory();
const onDelete = async () => {
const name = props.association['group-path'].split('/').pop();
if (prompt(`To confirm deleting this group, type ${name}`) === name) {
if (props.owner) {
const shouldDelete = (prompt(`To confirm deleting this group, type ${name}`) === name);
if (!shouldDelete) return;
}
await props.api.contacts.delete(props.association["group-path"]);
history.push("/");
}
};
const action = props.owner ? "Delete" : "Leave";