Merge "Use localStorage for auto-save"

This commit is contained in:
jenkins-bot 2023-01-21 09:58:30 +00:00 committed by Gerrit Code Review
commit 87d67d4a1c
2 changed files with 4 additions and 3 deletions

View file

@ -6,7 +6,7 @@ var
lastControllerScrollOffset, lastControllerScrollOffset,
featuresEnabled = mw.config.get( 'wgDiscussionToolsFeaturesEnabled' ) || {}, featuresEnabled = mw.config.get( 'wgDiscussionToolsFeaturesEnabled' ) || {},
createMemoryStorage = require( './createMemoryStorage.js' ), createMemoryStorage = require( './createMemoryStorage.js' ),
storage = createMemoryStorage( mw.storage.session ), storage = createMemoryStorage( mw.storage ),
Parser = require( './Parser.js' ), Parser = require( './Parser.js' ),
ThreadItemSet = require( './ThreadItemSet.js' ), ThreadItemSet = require( './ThreadItemSet.js' ),
CommentDetails = require( './CommentDetails.js' ), CommentDetails = require( './CommentDetails.js' ),

View file

@ -115,7 +115,7 @@ ReplyWidgetVisual.prototype.setup = function ( data, suppressNotifications ) {
focus: [ 'emit', 'bodyFocus' ] focus: [ 'emit', 'bodyFocus' ]
} ); } );
var listStorage = ve.init.platform.createListStorage( widget.storage ); var listStorage = ve.init.platform.createConflictableStorage( widget.storage );
// widget.storage is a MemoryStorage object. Copy over the .data cache so // widget.storage is a MemoryStorage object. Copy over the .data cache so
// that listStorage reads from/writes to the same in-memory cache. // that listStorage reads from/writes to the same in-memory cache.
listStorage.data = widget.storage.data; listStorage.data = widget.storage.data;
@ -123,7 +123,8 @@ ReplyWidgetVisual.prototype.setup = function ( data, suppressNotifications ) {
target.initAutosave( { target.initAutosave( {
suppressNotifications: suppressNotifications, suppressNotifications: suppressNotifications,
docId: widget.storagePrefix, docId: widget.storagePrefix,
storage: listStorage storage: listStorage,
storageExpiry: 60 * 60 * 24 * 30
} ); } );
widget.afterSetup(); widget.afterSetup();