Mooeypoo has uploaded a new change for review.

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

Change subject: Skip redundant bundle-id expansion when marking entire xwiki 
bundle read
......................................................................

Skip redundant bundle-id expansion when marking entire xwiki bundle read

When we mark an entire bundle as read, we don't care if it was opened
before or not - we call the API for the list of sources and their items
and build a list of IDs to mark as read in the remote source.

Then, we make sure that bundleIDs are expanded, added to that list.

Previously, we then sent those IDs to 'markCrossWikiItemsRead'
which marked the item IDs in the remote wikis as read.
markCrossWikiItemsRead is also expanding item bundle
IDs (correctly, because we also use it when we mark individual
xwiki items, and they should be expanded)

However, in cases where we mark individual xwiki items, the
model list is already filled, so markCrossWikiItemsRead trusts
the models to deliver the sub items (and then expand on their
IDs properly)

In the case of marking an entire xwiki bundle as read without
opening it first, however, that operation is not only redundant,
it produces a problem where the models were not yet filled
(because the xwiki bundle wasn't opened) and so we get empty
array of IDs, and the API has nothing to mark as read.

The solution is simple in this case - skip this method for working
with an entire bundle. It's both a redundant operation and the
wrong model to check. Send the information directly to the API
instead.

Bug: T142143
Change-Id: I4ed3bbc5c83290ed5791060b124840b1c3b12a75
---
M modules/controller/mw.echo.Controller.js
1 file changed, 3 insertions(+), 2 deletions(-)


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

diff --git a/modules/controller/mw.echo.Controller.js 
b/modules/controller/mw.echo.Controller.js
index 3544e1d..a3a6944 100644
--- a/modules/controller/mw.echo.Controller.js
+++ b/modules/controller/mw.echo.Controller.js
@@ -685,14 +685,15 @@
 
                                        // Mark items as read in the API
                                        promises.push(
-                                               
controller.markCrossWikiItemsRead( idArray, listModel.getName() )
+                                               controller.api.markItemsRead( 
idArray, listModel.getName(), true )
                                        );
                                }
 
                                // Synchronously remove this model from the 
widget
                                controller.removeCrossWikiItem();
 
-                               return 
mw.echo.api.NetworkHandler.static.waitForAllPromises( promises );
+                               return 
mw.echo.api.NetworkHandler.static.waitForAllPromises( promises )
+                                                       .then( 
controller.refreshUnreadCount.bind( controller ) );
                        } );
        };
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4ed3bbc5c83290ed5791060b124840b1c3b12a75
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo <mor...@gmail.com>

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

Reply via email to