Fossil SCM

Modify the purging of stale forum post drafts to happen on only one visit per 24 hours instead of a random chance on each visit, and make it async so it does not block the still-initializing page. Fix a 'this' mis-reference in fossil.storage.keys() uncovered by that change.

stephan 2026-06-10 20:48 UTC forum-editor-2026
Commit 0db7eccd47f2e1295de01e2b6f9f314b5d55bc3896205976774ebb2fc2bad70c
--- src/fossil.page.forumpost.js
+++ src/fossil.page.forumpost.js
@@ -1348,11 +1348,19 @@
13481348
to start hidden so that it does not show up for no-JS
13491349
clients. */
13501350
e.classList.remove('initially-hidden');
13511351
});
13521352
1353
- if( plugInEditor && (Date.now() % 17 === 0) ){
1353
+ if( plugInEditor ){
13541354
/* Purge old drafts only every now and then. */
1355
- F.ForumPostEditor.purgeOldDrafts(/^draft-(reply|forumedit)-.*/)/*not purging forumnew*/;
1355
+ const now = Date.now();
1356
+ const lastPurge = +F.storage.get('forum-drafts-last-purge', 0);
1357
+ if( now - lastPurge > (24 * 60 * 60 * 1000 /*1 day ms*/) ){
1358
+ F.storage.set('forum-drafts-last-purge', now);
1359
+ setTimeout(()=>{
1360
+ /* Don't block the UI while we're doing I/O */
1361
+ F.ForumPostEditor.purgeOldDrafts(/^draft-(reply|forumedit)-.*/);
1362
+ }, 50);
1363
+ }
13561364
}
13571365
})/*F.onPageLoad callback*/;
13581366
})(window.fossil);
13591367
--- src/fossil.page.forumpost.js
+++ src/fossil.page.forumpost.js
@@ -1348,11 +1348,19 @@
1348 to start hidden so that it does not show up for no-JS
1349 clients. */
1350 e.classList.remove('initially-hidden');
1351 });
1352
1353 if( plugInEditor && (Date.now() % 17 === 0) ){
1354 /* Purge old drafts only every now and then. */
1355 F.ForumPostEditor.purgeOldDrafts(/^draft-(reply|forumedit)-.*/)/*not purging forumnew*/;
 
 
 
 
 
 
 
 
1356 }
1357 })/*F.onPageLoad callback*/;
1358 })(window.fossil);
1359
--- src/fossil.page.forumpost.js
+++ src/fossil.page.forumpost.js
@@ -1348,11 +1348,19 @@
1348 to start hidden so that it does not show up for no-JS
1349 clients. */
1350 e.classList.remove('initially-hidden');
1351 });
1352
1353 if( plugInEditor ){
1354 /* Purge old drafts only every now and then. */
1355 const now = Date.now();
1356 const lastPurge = +F.storage.get('forum-drafts-last-purge', 0);
1357 if( now - lastPurge > (24 * 60 * 60 * 1000 /*1 day ms*/) ){
1358 F.storage.set('forum-drafts-last-purge', now);
1359 setTimeout(()=>{
1360 /* Don't block the UI while we're doing I/O */
1361 F.ForumPostEditor.purgeOldDrafts(/^draft-(reply|forumedit)-.*/);
1362 }, 50);
1363 }
1364 }
1365 })/*F.onPageLoad callback*/;
1366 })(window.fossil);
1367
--- src/fossil.storage.js
+++ src/fossil.storage.js
@@ -182,11 +182,11 @@
182182
},
183183
/** Returns an array of all keys currently in the storage. If full
184184
is true then the keys include the storage key prefix, else
185185
they don't. It should default to false but does not for
186186
historical compatibility. */
187
- keys: (full=true)=>{
187
+ keys: function(full=true){
188188
const li = Object.keys($storageHolder).filter((v)=>(v||'').startsWith(storageKeyPrefix));
189189
if( full ) return li;
190190
const n = this.storageKeyPrefix.length;
191191
return li.map(v=>v.substring(n));
192192
},
193193
--- src/fossil.storage.js
+++ src/fossil.storage.js
@@ -182,11 +182,11 @@
182 },
183 /** Returns an array of all keys currently in the storage. If full
184 is true then the keys include the storage key prefix, else
185 they don't. It should default to false but does not for
186 historical compatibility. */
187 keys: (full=true)=>{
188 const li = Object.keys($storageHolder).filter((v)=>(v||'').startsWith(storageKeyPrefix));
189 if( full ) return li;
190 const n = this.storageKeyPrefix.length;
191 return li.map(v=>v.substring(n));
192 },
193
--- src/fossil.storage.js
+++ src/fossil.storage.js
@@ -182,11 +182,11 @@
182 },
183 /** Returns an array of all keys currently in the storage. If full
184 is true then the keys include the storage key prefix, else
185 they don't. It should default to false but does not for
186 historical compatibility. */
187 keys: function(full=true){
188 const li = Object.keys($storageHolder).filter((v)=>(v||'').startsWith(storageKeyPrefix));
189 if( full ) return li;
190 const n = this.storageKeyPrefix.length;
191 return li.map(v=>v.substring(n));
192 },
193

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button