diff --git a/modules/api/mw.echo.api.EchoApi.js b/modules/api/mw.echo.api.EchoApi.js index 0da699d76..a2d219ffe 100644 --- a/modules/api/mw.echo.api.EchoApi.js +++ b/modules/api/mw.echo.api.EchoApi.js @@ -16,7 +16,6 @@ this.fetchingPromise = null; this.limit = config.limit || 25; this.fetchingPrioritizer = new mw.echo.api.PromisePrioritizer(); - this.bundle = !!config.bundle; }; OO.initClass( mw.echo.api.EchoApi ); @@ -100,6 +99,7 @@ * state, 'all', 'read' or 'unread' * @param {boolean} [filterObject.unreadFirst] Fetch unread notifications * first in the sorting order. + * @param {boolean} [filterObject.bundle] Bundle local notifications * @param {string|string[]} [filterObject.titles] Requested titles. To request notifications with no title, * use null (standalone or as an array element). * @return {Object} API parameter definitions to override @@ -110,8 +110,6 @@ filterObject = filterObject || {}; - overrideParams.notbundle = this.bundle; - if ( filterObject.continue ) { overrideParams.notcontinue = filterObject.continue; } @@ -120,6 +118,10 @@ overrideParams.notunreadfirst = 1; } + if ( filterObject.bundle ) { + overrideParams.notbundle = 1; + } + if ( filterObject.readState && filterObject.readState !== 'all' ) { overrideParams.notfilter = filterObject.readState === 'read' ? 'read' : @@ -203,11 +205,12 @@ * * @param {string[]} sourceArray An array of sources to fetch from the group * @param {string} type Notification type + * @param {boolean} bundle Bundle local notifications * @return {jQuery.Promise} A promise that resolves with an object that maps wiki * names to an array of their items' API data objects. */ - mw.echo.api.EchoApi.prototype.fetchNotificationGroups = function ( sourceArray, type ) { - var overrideParams = { notbundle: this.bundle, notcrosswikisummary: false }; + mw.echo.api.EchoApi.prototype.fetchNotificationGroups = function ( sourceArray, type, bundle ) { + var overrideParams = { notcrosswikisummary: false, notbundle: bundle }; return this.network.getApiHandler( 'local' ).fetchNotifications( type, sourceArray, true, overrideParams ) .then( function ( result ) { var i, diff --git a/modules/controller/mw.echo.Controller.js b/modules/controller/mw.echo.Controller.js index 3544e1d08..ff9cae80f 100644 --- a/modules/controller/mw.echo.Controller.js +++ b/modules/controller/mw.echo.Controller.js @@ -253,7 +253,7 @@ // between local notifications and x-wiki notifications // until the backend gives us the x-wiki notifications as // part of the original response. - return this.api.fetchNotifications( this.manager.getTypeString(), 'local', !!isForced, { unreadFirst: true } /* filters */ ) + return this.api.fetchNotifications( this.manager.getTypeString(), 'local', !!isForced, { unreadFirst: true, bundle: true } /* filters */ ) .then( // Success function ( data ) { @@ -521,7 +521,7 @@ return $.Deferred().reject().promise(); } - return this.api.fetchNotificationGroups( xwikiModel.getSourceNames(), this.manager.getTypeString() ) + return this.api.fetchNotificationGroups( xwikiModel.getSourceNames(), this.manager.getTypeString(), true ) .then( function ( groupList ) { var i, notifData, listModel, group, groupItems, diff --git a/modules/ext.echo.init.js b/modules/ext.echo.init.js index 1b925a8b8..29b78d3ad 100644 --- a/modules/ext.echo.init.js +++ b/modules/ext.echo.init.js @@ -43,7 +43,7 @@ $( this ).addClass( 'mw-echo-notifications-badge-dimmed' ); // Fire the notification API requests - echoApi = new mw.echo.api.EchoApi( { bundle: true } ); + echoApi = new mw.echo.api.EchoApi(); echoApi.fetchNotifications( myType ) .then( function ( data ) { mw.track( 'timing.MediaWiki.echo.overlay.api', mw.now() - time ); diff --git a/modules/special/ext.echo.special.js b/modules/special/ext.echo.special.js index 096894b5c..16bcfa50c 100644 --- a/modules/special/ext.echo.special.js +++ b/modules/special/ext.echo.special.js @@ -9,7 +9,7 @@ limitNotifications = 50, links = mw.config.get( 'wgNotificationsSpecialPageLinks' ), $content = $( '#mw-content-text' ), - echoApi = new mw.echo.api.EchoApi( { limit: limitNotifications, bundle: false } ), + echoApi = new mw.echo.api.EchoApi( { limit: limitNotifications } ), unreadCounter = new mw.echo.dm.UnreadNotificationCounter( echoApi, [ 'message', 'alert' ], limitNotifications ), modelManager = new mw.echo.dm.ModelManager( unreadCounter, { type: [ 'message', 'alert' ],