Skip to content

[3.0] Read the draft autosave frequency from the setting that exists - #9412

Merged
live627 merged 1 commit into
SimpleMachines:release-3.0from
albertlast:3.0/drafts-autosave-frequency
Aug 9, 2026
Merged

[3.0] Read the draft autosave frequency from the setting that exists#9412
live627 merged 1 commit into
SimpleMachines:release-3.0from
albertlast:3.0/drafts-autosave-frequency

Conversation

@albertlast

Copy link
Copy Markdown
Collaborator

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_frequencyActions/Admin/Posts.php:299 and :534, with $txt['drafts_autosave_frequency'] labelling it. But the three places that hand the interval to the editor read a different setting:

'iFreq' => empty(Config::$modSettings['masterAutoSaveDraftsDelay']) ? 60000 : Config::$modSettings['masterAutoSaveDraftsDelay'] * 1000,

masterAutoSaveDraftsDelay is the SMF 2.0 name. Nothing in 3.0 writes it, so empty() is always true and the fallback always wins. 2.1 already called it drafts_autosave_frequency (Sources/ManagePosts.php), and Sources/Editor.php:571 reads 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:1779 posting and editing
Sources/Actions/Display.php:1318 quick reply
Sources/PersonalMessage/PM.php:804 personal messages

opt.iFreq is what sceditor.plugins.drafts.js puts into setInterval(), 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:

before   "iFreq": 60000     posting, quick reply, personal message
after    "iFreq": 30000     posting, quick reply, personal message

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.php against the #7933 branch, which makes the same correction.

Issues References (Fixes|Related|Closes)

Related to #7933

"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>
@jdarwood007 jdarwood007 added this to the 3.0 Alpha 6 milestone Aug 8, 2026
@live627 live627 added Theme Regression A recent change has introduced a new bug. labels Aug 9, 2026
@live627
live627 merged commit 9c7d6d8 into SimpleMachines:release-3.0 Aug 9, 2026
4 checks passed
@jdarwood007 jdarwood007 modified the milestones: 3.0 Alpha 6, 3.0 Alpha 5 Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Drafts Regression A recent change has introduced a new bug. Theme

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants