diff --git a/modules/api/mw.echo.api.APIHandler.js b/modules/api/mw.echo.api.APIHandler.js index 213e87a01..d802287f1 100644 --- a/modules/api/mw.echo.api.APIHandler.js +++ b/modules/api/mw.echo.api.APIHandler.js @@ -119,7 +119,6 @@ notsections: this.normalizedType[ type ], notformat: 'model', notlimit: this.limit, - notunreadfirst: 1, notprop: 'list|count', uselang: this.userLang }, this.getTypeParams( type ) ); diff --git a/modules/api/mw.echo.api.EchoApi.js b/modules/api/mw.echo.api.EchoApi.js index 11e224813..4dcf3195c 100644 --- a/modules/api/mw.echo.api.EchoApi.js +++ b/modules/api/mw.echo.api.EchoApi.js @@ -98,6 +98,8 @@ * defining the offset to fetch notifications * @param {string} [filterObject.readState] Notification read * state, 'all', 'read' or 'unread' + * @param {boolean} [filterObject.unreadFirst] Fetch unread notifications + * first in the sorting order. * @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 @@ -114,6 +116,10 @@ overrideParams.notcontinue = filterObject.continue; } + if ( filterObject.unreadFirst ) { + overrideParams.notunreadfirst = 1; + } + if ( filterObject.readState && filterObject.readState !== 'all' ) { overrideParams.notfilter = filterObject.readState === 'read' ? 'read' : diff --git a/modules/controller/mw.echo.Controller.js b/modules/controller/mw.echo.Controller.js index a6a1041a7..5cc7a4502 100644 --- a/modules/controller/mw.echo.Controller.js +++ b/modules/controller/mw.echo.Controller.js @@ -226,7 +226,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 ) + return this.api.fetchNotifications( this.manager.getTypeString(), 'local', !!isForced, { unreadFirst: true } /* filters */ ) .then( // Success function ( data ) {