1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00

Basic flow for triggering db export on user deletion

This commit is contained in:
Nazar Gargol 2019-12-16 20:33:20 +07:00 committed by Daniel Lockyer
parent 843d91359a
commit 49ccc6b66d

View file

@ -84,7 +84,9 @@ export default Controller.extend({
},
deleteUser() {
return this._deleteUser().then(() => {
return this._deleteUser()
.then(filename => this._exportDb(filename))
.then(() => {
this._deleteUserSuccess();
}, () => {
this._deleteUserFailure();
@ -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');