Hoo man has uploaded a new change for review.

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

Change subject: Fix UsageUpdater subscription behaviour
......................................................................

Fix UsageUpdater subscription behaviour

We need to check which entity ids didn't have any usages
before inserting the new usages.

Manually tested.

Fixes af0e2517dfb9f1706bbf6010cfc2ef1885372c9f

Change-Id: Icf0281a78ae79feee408bdbb2156caae97b67dff
---
M client/includes/Store/UsageUpdater.php
1 file changed, 4 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/34/292834/1

diff --git a/client/includes/Store/UsageUpdater.php 
b/client/includes/Store/UsageUpdater.php
index ff4ae60..4710162 100644
--- a/client/includes/Store/UsageUpdater.php
+++ b/client/includes/Store/UsageUpdater.php
@@ -73,15 +73,14 @@
                        throw new InvalidArgumentException( '$pageId must be an 
int!' );
                }
 
+               $usageEntityIds = $this->getEntityIds( $usages );
+               $newlyUsedEntities = $this->usageLookup->getUnusedEntities( 
$usageEntityIds );
+
                $this->usageTracker->addUsedEntities( $pageId, $usages );
 
-               $newlyUsedEntities = $this->getEntityIds( $usages );
                // Subscribe to anything that was unused before.
                if ( !empty( $newlyUsedEntities ) ) {
-                       $newlyUsedEntities = 
$this->usageLookup->getUnusedEntities( $newlyUsedEntities );
-                       if ( !empty( $newlyUsedEntities ) ) {
-                               $this->subscriptionManager->subscribe( 
$this->clientId, $newlyUsedEntities );
-                       }
+                       $this->subscriptionManager->subscribe( $this->clientId, 
$newlyUsedEntities );
                }
        }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icf0281a78ae79feee408bdbb2156caae97b67dff
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Hoo man <h...@online.de>

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

Reply via email to