Merge "Update watchlist status from API result"

This commit is contained in:
jenkins-bot 2020-09-01 00:29:03 +00:00 committed by Gerrit Code Review
commit 7e069cdb00
2 changed files with 4 additions and 4 deletions

View file

@ -307,8 +307,6 @@ CommentController.prototype.save = function ( comment, pageName ) {
}
return $.Deferred().reject( code, responseData ).promise();
} ).then( function ( responseData ) {
// Pass through watchlist state.
responseData.watchlist = data.watchlist;
controller.update( responseData, comment, pageName, replyWidget );
} );
} );

View file

@ -276,14 +276,16 @@ function update( data, comment, pageName, replyWidget ) {
} );
}
// Update watch link to match 'watch checkbox' in save dialog.
// User logged in if module loaded.
if ( mw.loader.getState( 'mediawiki.page.watch.ajax' ) === 'ready' ) {
watch = require( 'mediawiki.page.watch.ajax' );
watch.updateWatchLink(
// eslint-disable-next-line no-jquery/no-global-selector
$( '#ca-watch a, #ca-unwatch a' ),
data.watchlist === 'watch' ? 'unwatch' : 'watch'
data.watched ? 'unwatch' : 'watch',
'idle',
data.watchlistexpiry
);
}