Catrope has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/295338

Change subject: Improve client-side unread count estimation
......................................................................

Improve client-side unread count estimation

- Remove duplicated counter adjustments.

- Differentiate between all IDs to mark as
  read vs. all IDs that represent visible
  notifications when adjusting the counter.

Change-Id: I1b3e52a929c6e920e3b782c9ef028539b3db0c99
(cherry picked from commit 5a5e1970c5e8e08ec8ee502b53a5a9937f888d70)
---
M modules/controller/mw.echo.Controller.js
1 file changed, 2 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo 
refs/changes/38/295338/1

diff --git a/modules/controller/mw.echo.Controller.js 
b/modules/controller/mw.echo.Controller.js
index ea08418..3f54ae0 100644
--- a/modules/controller/mw.echo.Controller.js
+++ b/modules/controller/mw.echo.Controller.js
@@ -302,7 +302,7 @@
                for ( i = 0; i < items.length; i++ ) {
                        item = items[ i ];
                        if ( !item.isRead() ) {
-                               itemIds = itemIds.concat( item.getAllIds() );
+                               itemIds.push( item.getId() );
                        }
                }
 
@@ -410,7 +410,7 @@
                        notification.toggleRead( isRead );
                } );
 
-               this.manager.getUnreadCounter().estimateChange( isRead ? 
-allIds.length : allIds.length );
+               this.manager.getUnreadCounter().estimateChange( isRead ? 
-itemIds.length : itemIds.length );
 
                return this.api.markItemsRead( allIds, model.getSource(), 
isRead ).then( this.refreshUnreadCount.bind( this ) );
        };
@@ -484,7 +484,6 @@
                                // Synchronously remove this model from the 
widget
                                controller.removeCrossWikiItem();
 
-                               controller.manager.counter.estimateChange( 
-itemCounter );
                                return 
mw.echo.api.NetworkHandler.static.waitForAllPromises( promises );
                        } );
        };

-- 
To view, visit https://gerrit.wikimedia.org/r/295338
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1b3e52a929c6e920e3b782c9ef028539b3db0c99
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: wmf/1.28.0-wmf.7
Gerrit-Owner: Catrope <roan.katt...@gmail.com>
Gerrit-Reviewer: Sbisson <sbis...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to