Merge pull request #3443 from tylershuster/group-confirm-delete

groups: add group deletion confirmation
This commit is contained in:
matildepark 2020-09-08 12:35:35 -04:00 committed by GitHub
commit a1b06689d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -324,12 +324,14 @@ export class GroupDetail extends Component {
<a className={'dib f9 ba pa2 ' + deleteButtonClasses} <a className={'dib f9 ba pa2 ' + deleteButtonClasses}
onClick={() => { onClick={() => {
if (groupOwner) { if (groupOwner) {
if (prompt(`To confirm deleting this group, type ${props.path.substr(6)}`) === props.path.substr(6)) {
this.setState({ awaiting: true, type: 'Deleting' }, (() => { this.setState({ awaiting: true, type: 'Deleting' }, (() => {
props.api.contacts.delete(props.path).then(() => { props.api.contacts.delete(props.path).then(() => {
props.history.push('/~groups'); props.history.push('/~groups');
}); });
})); }));
} }
}
}} }}
>Delete this group</a> >Delete this group</a>
</div> </div>