mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-23 23:44:53 +00:00
Enable local bundles on mobile
Have the 'bundle' param always controlled by the controller instead of configured in the API. Change-Id: I08fb7c515f1af28fc01073702b552624cc14f2f0
This commit is contained in:
parent
61e9957a95
commit
3600a271c5
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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' ],
|
||||
|
|
Loading…
Reference in a new issue