mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-04 17:04:59 +03:00
a5475f1519
no issue - if a theme was uploaded with the same name as a previously deleted theme it was not being shown in the themes list, and if activated could not be found/seen as active breaking the design menu
32 lines
1.0 KiB
JavaScript
32 lines
1.0 KiB
JavaScript
import Component from '@glimmer/component';
|
|
import {action} from '@ember/object';
|
|
import {inject as service} from '@ember/service';
|
|
import {task} from 'ember-concurrency-decorators';
|
|
|
|
export default class ConfirmDeleteThemeComponent extends Component {
|
|
@service ghostPaths;
|
|
@service notifications;
|
|
@service utils;
|
|
|
|
@action
|
|
downloadTheme(event) {
|
|
event.preventDefault();
|
|
this.utils.downloadFile(`${this.ghostPaths.apiRoot}/themes/${this.args.data.theme.name}/download/`);
|
|
}
|
|
|
|
@task
|
|
*deleteThemeTask() {
|
|
try {
|
|
yield this.args.data.theme.destroyRecord();
|
|
// we need to unload from the store here so that uploading another
|
|
// theme with the same "id" doesn't attempt to update the deleted record
|
|
this.args.data.theme.unloadRecord();
|
|
this.args.close();
|
|
return true;
|
|
} catch (error) {
|
|
// TODO: show error in modal rather than generic message
|
|
this.notifications.showAPIError(error);
|
|
}
|
|
}
|
|
}
|