From de16c138527a82c5c7637eb3900dc322f104e768 Mon Sep 17 00:00:00 2001 From: Chris Raible Date: Wed, 11 Oct 2023 15:15:00 -0700 Subject: [PATCH] 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 --- ghost/admin/app/controllers/lexical-editor.js | 30 ++----------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/ghost/admin/app/controllers/lexical-editor.js b/ghost/admin/app/controllers/lexical-editor.js index ac72c0da01..9fc99cbe27 100644 --- a/ghost/admin/app/controllers/lexical-editor.js +++ b/ghost/admin/app/controllers/lexical-editor.js @@ -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() {