Ghost/ghost/admin/app/components/settings/staff/modals/suspend-user.js
Kevin Ansfield 85cce39af7 Refactored staff user modals
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
2022-10-03 21:15:34 +01:00

25 lines
737 B
JavaScript

import Component from '@glimmer/component';
import {inject as service} from '@ember/service';
import {task} from 'ember-concurrency';
export default class SuspendUserModal extends Component {
@service notifications;
@task({drop: true})
*suspendUserTask() {
try {
const {user, saveTask} = this.args.data;
user.status = 'inactive';
yield saveTask.perform();
this.notifications.closeAlerts('user.suspend');
} catch (error) {
this.notifications.showAlert('The user could not be suspended. Please try again.', {type: 'error', key: 'user.suspend.failed'});
throw error;
} finally {
this.args.close();
}
}
}