diff --git a/includes/ApiVisualEditorEdit.php b/includes/ApiVisualEditorEdit.php index e088752627..44df6bc4b1 100644 --- a/includes/ApiVisualEditorEdit.php +++ b/includes/ApiVisualEditorEdit.php @@ -451,6 +451,8 @@ class ApiVisualEditorEdit extends ApiBase { $result['newrevid'] = intval( $saveresult['edit']['newrevid'] ); } + $result['watched'] = $saveresult['edit']['watched'] ?? false; + $result['watchlistexpiry'] = $saveresult['edit']['watchlistexpiry'] ?? null; $result['result'] = 'success'; } } diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js index 24a862a917..adebf65b25 100644 --- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js +++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js @@ -903,7 +903,7 @@ ve.init.mw.DesktopArticleTarget.prototype.onViewTabClick = function ( e ) { * @inheritdoc */ ve.init.mw.DesktopArticleTarget.prototype.saveComplete = function ( data ) { - var newUrlParams, watchChecked, watch, + var newUrlParams, watch, target = this; // Parent method @@ -926,10 +926,12 @@ ve.init.mw.DesktopArticleTarget.prototype.saveComplete = function ( data ) { // User logged in if module loaded. if ( mw.loader.getState( 'mediawiki.page.watch.ajax' ) === 'ready' ) { watch = require( 'mediawiki.page.watch.ajax' ); - watchChecked = this.checkboxesByName.wpWatchthis && this.checkboxesByName.wpWatchthis.isSelected(); + watch.updateWatchLink( $( '#ca-watch a, #ca-unwatch a' ), - watchChecked ? 'unwatch' : 'watch' + data.watched ? 'unwatch' : 'watch', + 'idle', + data.watchlistexpiry ); }