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.fetchingPromise = null;
this.limit = config.limit || 25; this.limit = config.limit || 25;
this.fetchingPrioritizer = new mw.echo.api.PromisePrioritizer(); this.fetchingPrioritizer = new mw.echo.api.PromisePrioritizer();
this.bundle = !!config.bundle;
}; };
OO.initClass( mw.echo.api.EchoApi ); OO.initClass( mw.echo.api.EchoApi );
@ -100,6 +99,7 @@
* state, 'all', 'read' or 'unread' * state, 'all', 'read' or 'unread'
* @param {boolean} [filterObject.unreadFirst] Fetch unread notifications * @param {boolean} [filterObject.unreadFirst] Fetch unread notifications
* first in the sorting order. * 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, * @param {string|string[]} [filterObject.titles] Requested titles. To request notifications with no title,
* use null (standalone or as an array element). * use null (standalone or as an array element).
* @return {Object} API parameter definitions to override * @return {Object} API parameter definitions to override
@ -110,8 +110,6 @@
filterObject = filterObject || {}; filterObject = filterObject || {};
overrideParams.notbundle = this.bundle;
if ( filterObject.continue ) { if ( filterObject.continue ) {
overrideParams.notcontinue = filterObject.continue; overrideParams.notcontinue = filterObject.continue;
} }
@ -120,6 +118,10 @@
overrideParams.notunreadfirst = 1; overrideParams.notunreadfirst = 1;
} }
if ( filterObject.bundle ) {
overrideParams.notbundle = 1;
}
if ( filterObject.readState && filterObject.readState !== 'all' ) { if ( filterObject.readState && filterObject.readState !== 'all' ) {
overrideParams.notfilter = filterObject.readState === 'read' ? overrideParams.notfilter = filterObject.readState === 'read' ?
'read' : 'read' :
@ -203,11 +205,12 @@
* *
* @param {string[]} sourceArray An array of sources to fetch from the group * @param {string[]} sourceArray An array of sources to fetch from the group
* @param {string} type Notification type * @param {string} type Notification type
* @param {boolean} bundle Bundle local notifications
* @return {jQuery.Promise} A promise that resolves with an object that maps wiki * @return {jQuery.Promise} A promise that resolves with an object that maps wiki
* names to an array of their items' API data objects. * names to an array of their items' API data objects.
*/ */
mw.echo.api.EchoApi.prototype.fetchNotificationGroups = function ( sourceArray, type ) { mw.echo.api.EchoApi.prototype.fetchNotificationGroups = function ( sourceArray, type, bundle ) {
var overrideParams = { notbundle: this.bundle, notcrosswikisummary: false }; var overrideParams = { notcrosswikisummary: false, notbundle: bundle };
return this.network.getApiHandler( 'local' ).fetchNotifications( type, sourceArray, true, overrideParams ) return this.network.getApiHandler( 'local' ).fetchNotifications( type, sourceArray, true, overrideParams )
.then( function ( result ) { .then( function ( result ) {
var i, var i,

View file

@ -253,7 +253,7 @@
// between local notifications and x-wiki notifications // between local notifications and x-wiki notifications
// until the backend gives us the x-wiki notifications as // until the backend gives us the x-wiki notifications as
// part of the original response. // 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( .then(
// Success // Success
function ( data ) { function ( data ) {
@ -521,7 +521,7 @@
return $.Deferred().reject().promise(); return $.Deferred().reject().promise();
} }
return this.api.fetchNotificationGroups( xwikiModel.getSourceNames(), this.manager.getTypeString() ) return this.api.fetchNotificationGroups( xwikiModel.getSourceNames(), this.manager.getTypeString(), true )
.then( .then(
function ( groupList ) { function ( groupList ) {
var i, notifData, listModel, group, groupItems, var i, notifData, listModel, group, groupItems,

View file

@ -43,7 +43,7 @@
$( this ).addClass( 'mw-echo-notifications-badge-dimmed' ); $( this ).addClass( 'mw-echo-notifications-badge-dimmed' );
// Fire the notification API requests // Fire the notification API requests
echoApi = new mw.echo.api.EchoApi( { bundle: true } ); echoApi = new mw.echo.api.EchoApi();
echoApi.fetchNotifications( myType ) echoApi.fetchNotifications( myType )
.then( function ( data ) { .then( function ( data ) {
mw.track( 'timing.MediaWiki.echo.overlay.api', mw.now() - time ); mw.track( 'timing.MediaWiki.echo.overlay.api', mw.now() - time );

View file

@ -9,7 +9,7 @@
limitNotifications = 50, limitNotifications = 50,
links = mw.config.get( 'wgNotificationsSpecialPageLinks' ), links = mw.config.get( 'wgNotificationsSpecialPageLinks' ),
$content = $( '#mw-content-text' ), $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 ), unreadCounter = new mw.echo.dm.UnreadNotificationCounter( echoApi, [ 'message', 'alert' ], limitNotifications ),
modelManager = new mw.echo.dm.ModelManager( unreadCounter, { modelManager = new mw.echo.dm.ModelManager( unreadCounter, {
type: [ 'message', 'alert' ], type: [ 'message', 'alert' ],