Aude has uploaded a new change for review.

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

Change subject: Fix issue of missing languages in "other languages" term box
......................................................................

Fix issue of missing languages in "other languages" term box

Concatenating the $allLanguages array in EntityParserOutputGenerator
doesn't work correctly when the arrays have numeric keys. (any elements
in the second array with duplicate keys in the first array won't get
appended).

Instead we should use array_merge here.

@todo: split the code that generates the TermListView here
into a separate class so it can be tested more properly.

Bug: T134432
Change-Id: I309669d0149f3fd6185a50881b468012e7b30d63
---
M repo/includes/ParserOutput/EntityParserOutputGenerator.php
1 file changed, 6 insertions(+), 3 deletions(-)


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

diff --git a/repo/includes/ParserOutput/EntityParserOutputGenerator.php 
b/repo/includes/ParserOutput/EntityParserOutputGenerator.php
index 22434e4..88d46aa 100644
--- a/repo/includes/ParserOutput/EntityParserOutputGenerator.php
+++ b/repo/includes/ParserOutput/EntityParserOutputGenerator.php
@@ -307,13 +307,16 @@
                );
                $allLanguages = [];
                if ( $entity instanceof AliasesProvider ) {
-                       $allLanguages += array_keys( 
$entity->getAliasGroups()->toTextArray() );
+                       $aliasLanguages = array_keys( 
$entity->getAliasGroups()->toTextArray() );
+                       $allLanguages = array_merge( $allLanguages, 
$aliasLanguages );
                }
                if ( $entity instanceof DescriptionsProvider ) {
-                       $allLanguages += array_keys( 
$entity->getDescriptions()->toTextArray() );
+                       $descriptionLanguages = array_keys( 
$entity->getDescriptions()->toTextArray() );
+                       $allLanguages = array_merge( $allLanguages, 
$descriptionLanguages );
                }
                if ( $entity instanceof LabelsProvider ) {
-                       $allLanguages += array_keys( 
$entity->getLabels()->toTextArray() );
+                       $labelLanguages = array_keys( 
$entity->getLabels()->toTextArray() );
+                       $allLanguages = array_merge( $allLanguages, 
$labelLanguages );
                }
                $allLanguages = array_unique( $allLanguages );
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I309669d0149f3fd6185a50881b468012e7b30d63
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Aude <aude.w...@gmail.com>

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

Reply via email to