Stopped downloading site backup when deleting a user

refs https://github.com/TryGhost/Ghost/issues/15008

- Backup process had a slim benefit to keep around. Without it the removal process is much smoother.
- The backup still happens on the server side if it's absolutely needed at some point in the future
This commit is contained in:
Naz 2022-07-08 10:37:56 +02:00 committed by naz
parent 87eafc1ae4
commit 04d27fac5f
2 changed files with 4 additions and 18 deletions

View File

@ -6,14 +6,11 @@
<div class="modal-body">
{{#if this.user.count.posts}}
<p>
<strong>{{this.user.name}}</strong> and their <strong data-test-text="user-post-count">{{gh-pluralize this.user.count.posts 'post'}}</strong> will be permanently deleted. If you dont want to lose these posts, you should assign them to a different author.
</p>
<p>
A backup will be automatically downloaded to your device before deletion.
<strong>{{this.user.name}}</strong> and their <strong data-test-text="user-post-count">{{gh-pluralize this.user.count.posts 'post'}}</strong> will be permanently deleted.
</p>
{{else}}
<p>
<strong>{{this.user.name}}</strong> will be permanently deleted. A backup will be automatically downloaded to your device before deletion.
<strong>{{this.user.name}}</strong> will be permanently deleted.
</p>
{{/if}}
</div>
@ -22,7 +19,7 @@
<button class="gh-btn" data-test-button="cancel-delete-user" type="button" {{action "closeModal"}}>
<span>Cancel</span>
</button>
<GhTaskButton @buttonText="Download backup & delete user"
<GhTaskButton @buttonText="Delete user"
@successText="Deleted"
@task={{this.deleteUser}}
@class="gh-btn gh-btn-red gh-btn-icon"

View File

@ -385,20 +385,9 @@ export default Controller.extend({
this.user.commentNotifications = event.target.checked;
}),
_exportDb(filename) {
this.utils.downloadFile(`${this.ghostPaths.url.api('db')}?filename=${filename}`);
},
deleteUser: task(function *() {
try {
const result = yield this.user.destroyRecord();
if (result._meta && result._meta.filename) {
this._exportDb(result._meta.filename);
// give the iframe some time to trigger the download before
// it's removed from the dom when transitioning
yield timeout(300);
}
yield this.user.destroyRecord();
this.notifications.closeAlerts('user.delete');
this.store.unloadAll('post');