Catrope has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/384300 )

Change subject: ContainmentSet: Work around unhelpful behavior of 
lookupCentralIds()
......................................................................

ContainmentSet: Work around unhelpful behavior of lookupCentralIds()

Explicitly set all array values to null before the call, and filter
out nulls after the call, to avoid inserting meaningless numbers
into the set when some IDs fail to be looked up.

Bug: T177825
Change-Id: I8cf03e7ca368cf985dc4cb1ee3536d35531324b2
---
M includes/ContainmentSet.php
1 file changed, 4 insertions(+), 2 deletions(-)


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

diff --git a/includes/ContainmentSet.php b/includes/ContainmentSet.php
index 0803da0..b4a9bdf 100644
--- a/includes/ContainmentSet.php
+++ b/includes/ContainmentSet.php
@@ -75,8 +75,10 @@
 
                if ( $preference ) {
                        $lookup = CentralIdLookup::factory();
-                       $names = $lookup->lookupCentralIds( array_flip( 
$preference ), $this->recipient );
-                       $this->addArray( array_values( $names ) );
+                       // lookupCentralIds() "reports" missing IDs by simply 
not changing their associated values
+                       // Set all values to null so we can filter out the ones 
that weren't populated
+                       $names = $lookup->lookupCentralIds( array_fill_keys( 
$preference, null ), $this->recipient );
+                       $this->addArray( array_values( array_filter( $names ) ) 
);
                }
        }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8cf03e7ca368cf985dc4cb1ee3536d35531324b2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Catrope <r...@wikimedia.org>

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

Reply via email to