* @param {string|mw.Title|string[]|mw.Title[]} pages Full page name or instance of mw.Title, or an
* array thereof. If an array is passed, the return value passed to the promise will also be an
* array of appropriate objects.
+ * @param {Object} [addParams]
* @return {jQuery.Promise}
* @return {Function} return.done
* @return {Object|Object[]} return.done.watch Object or list of objects (depends on the `pages`
* parameter)
* @return {string} return.done.watch.title Full pagename
* @return {boolean} return.done.watch.watched Whether the page is now watched or unwatched
- * @return {string} return.done.watch.message Parsed HTML of the confirmational interface message
*/
function doWatchInternal( pages, addParams ) {
// XXX: Parameter addParams is undocumented because we inherit this
var apiPromise = this.postWithToken( 'watch',
$.extend(
{
+ formatversion: 2,
action: 'watch',
titles: $.isArray( pages ) ? pages.join( '|' ) : String( pages ),
uselang: mw.config.get( 'wgUserLanguage' )
api[ action ]( title )
.done( function ( watchResponse ) {
- var otherAction = action === 'watch' ? 'unwatch' : 'watch';
+ var mwTitle, message, otherAction = action === 'watch' ? 'unwatch' : 'watch';
- mw.notify( $.parseHTML( watchResponse.message ), {
+ mwTitle = mw.Title.newFromText( title );
+ if ( mwTitle && mwTitle.getNamespaceId() > 0 && mwTitle.getNamespaceId() % 2 === 1 ) {
+ message = action === 'watch' ? 'addedwatchtext-talk' : 'removedwatchtext-talk';
+ } else {
+ message = action === 'watch' ? 'addedwatchtext' : 'removedwatchtext';
+ }
+
+ mw.notify( mw.message( message, title ).parseDom(), {
tag: 'watch-self'
} );
// Update the "Watch this page" checkbox on action=edit when the
// page is watched or unwatched via the tab (bug 12395).
- $( '#wpWatchthis' ).prop( 'checked', watchResponse.watched !== undefined );
+ $( '#wpWatchthis' ).prop( 'checked', watchResponse.watched === true );
} )
.fail( function () {
var cleanTitle, msg, link;