[3.0] Read the draft autosave frequency from the setting that exists - #9412
Merged
live627 merged 1 commit intoAug 9, 2026
Merged
Conversation
"How often should drafts be autosaved?" in Admin -> Posts and Topics -> Drafts writes drafts_autosave_frequency, but the three places that hand the interval to the editor read masterAutoSaveDraftsDelay, which is the SMF 2.0 name. Nothing in 3.0 writes it, so the empty() check always won and every autosave ran at the hard coded 60 seconds, on posting, on quick reply and on personal messages alike. 2.1 already called this drafts_autosave_frequency, and Editor.php reads it under that name a few hundred lines away, so these three were the odd ones out. With the setting at 30 seconds the editor options rendered "iFreq": 60000 on all three pages before, and "iFreq": 30000 after. Signed-off-by: Mathias Papenbrock <mathiaspapealbert@hotmail.com> Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Admin → Posts and Topics → Drafts offers "How often should drafts be autosaved?", and it does nothing. Drafts autosave every 60 seconds whatever you set it to.
The admin form writes
drafts_autosave_frequency—Actions/Admin/Posts.php:299and:534, with$txt['drafts_autosave_frequency']labelling it. But the three places that hand the interval to the editor read a different setting:masterAutoSaveDraftsDelayis the SMF 2.0 name. Nothing in 3.0 writes it, soempty()is always true and the fallback always wins. 2.1 already called itdrafts_autosave_frequency(Sources/ManagePosts.php), andSources/Editor.php:571reads it under that name a few hundred lines from one of these — so these three are the odd ones out, not the setting.Affected:
Sources/Actions/Post.php:1779Sources/Actions/Display.php:1318Sources/PersonalMessage/PM.php:804opt.iFreqis whatsceditor.plugins.drafts.jsputs intosetInterval(), so this is the value that decides when an autosave actually fires.Checked
On the running forum with the setting at 30 seconds, and the per-member "autosave drafts" theme option turned on so the editor gets its draft options at all:
Same shape as #9394, where a guard compared a language against
'english', the 2.0 name. Worth a glance for others: I have not swept the codebase for further 2.0-era setting names, and that might be worth doing.Found while comparing
Sources/PersonalMessage/PM.phpagainst the #7933 branch, which makes the same correction.Issues References (Fixes|Related|Closes)
Related to #7933