Merge "Remove unnecessary IIFE"

This commit is contained in:
jenkins-bot 2024-04-19 22:12:34 +00:00 committed by Gerrit Code Review
commit 1f7d23e3d7

View file

@ -478,14 +478,9 @@ function init( $container, state ) {
$.Deferred().resolve().promise(); $.Deferred().resolve().promise();
// Restore autosave // Restore autosave
( function () { // Don't do anything when we're editing/previewing
if ( mw.config.get( 'wgAction' ) !== 'view' ) { if ( mw.config.get( 'wgAction' ) === 'view' ) {
// Don't do anything when we're editing/previewing pageThreads.threadItems.every( ( comment, i ) => {
return;
}
for ( let i = 0; i < pageThreads.threadItems.length; i++ ) {
const comment = pageThreads.threadItems[ i ];
const replyStorage = new MemoryStorage( mw.storage, 'mw-ext-DiscussionTools-reply/' + comment.id, STORAGE_EXPIRY ); const replyStorage = new MemoryStorage( mw.storage, 'mw-ext-DiscussionTools-reply/' + comment.id, STORAGE_EXPIRY );
if ( replyStorage.get( 'saveable' ) ) { if ( replyStorage.get( 'saveable' ) ) {
const mode = replyStorage.get( 'mode' ); const mode = replyStorage.get( 'mode' );
@ -502,9 +497,10 @@ function init( $container, state ) {
setupController( comment, $link, mode, true, !state.firstLoad, replyStorage ); setupController( comment, $link, mode, true, !state.firstLoad, replyStorage );
} ); } );
} ); } );
break; return false;
} }
} return true;
} );
const newTopicStorage = new MemoryStorage( mw.storage, 'mw-ext-DiscussionTools-reply/' + utils.NEW_TOPIC_COMMENT_ID, STORAGE_EXPIRY ); const newTopicStorage = new MemoryStorage( mw.storage, 'mw-ext-DiscussionTools-reply/' + utils.NEW_TOPIC_COMMENT_ID, STORAGE_EXPIRY );
if ( newTopicStorage.get( 'saveable' ) || newTopicStorage.get( 'title' ) ) { if ( newTopicStorage.get( 'saveable' ) || newTopicStorage.get( 'title' ) ) {
const mode = newTopicStorage.get( 'mode' ); const mode = newTopicStorage.get( 'mode' );
@ -513,7 +509,7 @@ function init( $container, state ) {
const data = linksController.parseNewTopicLink( location.href ); const data = linksController.parseNewTopicLink( location.href );
setupController( newTopicComment( data ), $( [] ) ); setupController( newTopicComment( data ), $( [] ) );
} }
}() ); }
// For debugging (now unused in the code) // For debugging (now unused in the code)
mw.dt.pageThreads = pageThreads; mw.dt.pageThreads = pageThreads;