From 3b4e4d30a8e83362ec03aabf81b353c00d73d283 Mon Sep 17 00:00:00 2001 From: Stephane Bisson Date: Wed, 3 Aug 2016 16:33:48 -0400 Subject: [PATCH] Mark all notifications in a foreign bundle as read Foreign notifications, though non-expandable, can represent bundles (4 new topics on your talk page). When marking one as read, it's important to provide all the IDs that are part of that bundle. Otherwise, only the dynamic base is marked as read and the bundle shows up again on reload (3 new topics on your talk page). For bundles that do not include the count (The description on Flow_Page was edited multiple times) it looks like the mark-as-read action did not work. Tagging with T140309 as it may explain it but not 100% sure. Bug: T140309 Change-Id: I19c9eb18669b7cad8173c966392a6e5977018121 --- modules/controller/mw.echo.Controller.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/controller/mw.echo.Controller.js b/modules/controller/mw.echo.Controller.js index d8ccbe81e..3544e1d08 100644 --- a/modules/controller/mw.echo.Controller.js +++ b/modules/controller/mw.echo.Controller.js @@ -629,6 +629,7 @@ mw.echo.Controller.prototype.markCrossWikiItemsRead = function ( itemIds, source ) { var sourceModel, notifs, + allIds = [], xwikiModel = this.manager.getNotificationModel( 'xwiki' ); if ( !xwikiModel ) { @@ -644,7 +645,10 @@ // Update pagination count this.manager.updateCurrentPageItemCount(); - return this.api.markItemsRead( itemIds, source, true ) + notifs.forEach( function ( notif ) { + allIds = allIds.concat( notif.getAllIds() ); + } ); + return this.api.markItemsRead( allIds, source, true ) .then( this.refreshUnreadCount.bind( this ) ); };