Merge "Enable local bundles on mobile"

This commit is contained in:
jenkins-bot 2016-08-05 22:00:35 +00:00 committed by Gerrit Code Review
commit 181c0b9557
4 changed files with 12 additions and 9 deletions

View file

@ -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,

View file

@ -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,

View file

@ -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 );

View file

@ -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' ],