mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-02 08:13:34 +03:00
85cce39af7
refs https://github.com/TryGhost/Team/issues/1734 refs https://github.com/TryGhost/Team/issues/559 refs https://github.com/TryGhost/Ghost/issues/14101 - switches to newer modal patterns ready for later Ember upgrades - cleaned up the `upload-image` modal which had multiple areas of code that were no longer being used - disabled `no-duplicate-landmark-elements` template lint rule as it's buggy and mostly gives false positives
32 lines
924 B
JavaScript
32 lines
924 B
JavaScript
import Component from '@glimmer/component';
|
|
import {inject as service} from '@ember/service';
|
|
import {task} from 'ember-concurrency';
|
|
|
|
export default class DeleteUserModal extends Component {
|
|
@service notifications;
|
|
@service router;
|
|
@service store;
|
|
|
|
get ownerUser() {
|
|
return this.store.peekAll('user').findBy('isOwnerOnly', true);
|
|
}
|
|
|
|
@task({drop: true})
|
|
*deleteUserTask() {
|
|
try {
|
|
const {user} = this.args.data;
|
|
|
|
yield user.destroyRecord();
|
|
|
|
this.notifications.closeAlerts('user.delete');
|
|
this.store.unloadAll('post');
|
|
this.router.transitionTo('settings.staff');
|
|
} catch (error) {
|
|
this.notifications.showAlert('The user could not be deleted. Please try again.', {type: 'error', key: 'user.delete.failed'});
|
|
throw error;
|
|
} finally {
|
|
this.args.close();
|
|
}
|
|
}
|
|
}
|