mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Basic flow for triggering db export on user deletion
This commit is contained in:
parent
8883a1e6f6
commit
70524c55a4
1 changed files with 22 additions and 5 deletions
|
@ -84,11 +84,13 @@ export default Controller.extend({
|
|||
},
|
||||
|
||||
deleteUser() {
|
||||
return this._deleteUser().then(() => {
|
||||
this._deleteUserSuccess();
|
||||
}, () => {
|
||||
this._deleteUserFailure();
|
||||
});
|
||||
return this._deleteUser()
|
||||
.then(filename => this._exportDb(filename))
|
||||
.then(() => {
|
||||
this._deleteUserSuccess();
|
||||
}, () => {
|
||||
this._deleteUserFailure();
|
||||
});
|
||||
},
|
||||
|
||||
toggleDeleteUserModal() {
|
||||
|
@ -356,6 +358,21 @@ export default Controller.extend({
|
|||
this.notifications.showAlert('The user could not be deleted. Please try again.', {type: 'error', key: 'user.delete.failed'});
|
||||
},
|
||||
|
||||
async _exportDb(filename) {
|
||||
let exportUrl = this.get('ghostPaths.url').api('db');
|
||||
let downloadURL = `${exportUrl}?filename=${filename}`;
|
||||
let iframe = document.getElementById('iframeDownload');
|
||||
|
||||
if (!iframe) {
|
||||
iframe = document.createElement('iframe');
|
||||
iframe.id = 'iframeDownload';
|
||||
iframe.style.display = 'none';
|
||||
document.body.append(iframe);
|
||||
}
|
||||
|
||||
iframe.setAttribute('src', downloadURL);
|
||||
},
|
||||
|
||||
updateSlug: task(function* (newSlug) {
|
||||
let slug = this.get('user.slug');
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue