0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00

Removed 10 minute Post-Revision autosave (#18586)

fixes TryGhost/Product#3480

- Removed this feature because it provides a surface area for bugs and
issues, and isn't really needed
This commit is contained in:
Chris Raible 2023-10-11 15:15:00 -07:00 committed by GitHub
parent e0f9d2cd26
commit de16c13852
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -34,8 +34,6 @@ const DUPLICATED_POST_TITLE_SUFFIX = '(Copy)';
const AUTOSAVE_TIMEOUT = 3000;
// time in ms to force a save if the user is continuously typing
const TIMEDSAVE_TIMEOUT = 60000;
// time in ms to force a save even if the post is already saved so we trigger a new revision on the server
const REVISIONSAVE_TIMEOUT = 1000 * 60 * 10; // 10 minutes
// this array will hold properties we need to watch for this.hasDirtyAttributes
let watchedProps = [
@ -202,13 +200,12 @@ export default class LexicalEditorController extends Controller {
return false;
}
@computed('_autosaveTask.isRunning', '_timedSaveTask.isRunning', '_revisionSaveTask.isRunning')
@computed('_autosaveTask.isRunning', '_timedSaveTask.isRunning')
get _autosaveRunning() {
let autosave = this.get('_autosaveTask.isRunning');
let timedsave = this.get('_timedSaveTask.isRunning');
let revisionsave = this.get('_revisionSaveTask.isRunning');
return autosave || timedsave || revisionsave;
return autosave || timedsave;
}
@computed('post.isDraft')
@ -224,8 +221,6 @@ export default class LexicalEditorController extends Controller {
this._autosaveTask.perform();
// force save at 60 seconds
this._timedSaveTask.perform();
// force save at 10 minutes to trigger revision
this._revisionSaveTask.perform();
}
@action
@ -260,7 +255,6 @@ export default class LexicalEditorController extends Controller {
cancelAutosave() {
this._autosaveTask.cancelAll();
this._timedSaveTask.cancelAll();
this._revisionSaveTask.cancelAll();
}
// called by the "are you sure?" modal
@ -444,7 +438,7 @@ export default class LexicalEditorController extends Controller {
this.cancelAutosave();
if (options.backgroundSave && !this.hasDirtyAttributes && !options.leavingEditor && !options.saveRevision) {
if (options.backgroundSave && !this.hasDirtyAttributes && !options.leavingEditor) {
return;
}
@ -498,9 +492,6 @@ export default class LexicalEditorController extends Controller {
return true;
}
// Even if we've just saved and nothing else has changed, we want to save in 10 minutes to force a revision
this._revisionSaveTask.perform();
return post;
} catch (error) {
if (!this.session.isAuthenticated) {
@ -1117,21 +1108,6 @@ export default class LexicalEditorController extends Controller {
}).drop())
_timedSaveTask;
// save at 10 minutes even if the post is already saved
@(task(function* () {
if (!this._canAutosave) {
return;
}
while (config.environment !== 'test' && true) {
yield timeout(REVISIONSAVE_TIMEOUT);
this.autosaveTask.perform({
saveRevision: this._canAutosave
});
}
}).drop())
_revisionSaveTask;
/* Private methods -------------------------------------------------------*/
_hasDirtyAttributes() {