Aude has uploaded a new change for review.
https://gerrit.wikimedia.org/r/124332
Change subject: Fix site links group filtering in ItemView
......................................................................
Fix site links group filtering in ItemView
Change-Id: I91fb11ed1547b903a932ebcf62f7d57888c7d965
---
M repo/includes/ItemView.php
1 file changed, 17 insertions(+), 5 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/32/124332/1
diff --git a/repo/includes/ItemView.php b/repo/includes/ItemView.php
index 368c2b8..2cb5efd 100644
--- a/repo/includes/ItemView.php
+++ b/repo/includes/ItemView.php
@@ -98,9 +98,24 @@
* @return string
*/
public function getHtmlForSiteLinkGroup( Item $item, $group, $editable
= true ) {
- $siteLinks = $item->getSiteLinks();
-
+ // @todo inject into constructor
+ $sites = SiteSQLStore::newInstance()->getSites();
$specialGroups =
WikibaseRepo::getDefaultInstance()->getSettings()->getSetting(
"specialSiteLinkGroups" );
+
+ $allSiteLinks = $item->getSiteLinks();
+ $siteLinks = array(); // site links of the currently handled
site group
+
+ foreach( $allSiteLinks as $siteLink ) {
+ $site = $sites->getSite( $siteLink->getSiteId() );
+
+ if ( $site === null ) {
+ continue;
+ }
+
+ if ( $site->getGroup() === $group ) {
+ $siteLinks[] = $siteLink;
+ }
+ }
$html = $thead = $tbody = $tfoot = '';
@@ -139,9 +154,6 @@
if ( !$sortOk ) {
$siteLinks = $safetyCopy;
}
-
- // @todo inject into constructor
- $sites = SiteSQLStore::newInstance()->getSites();
// Link to SpecialPage
$editLink = $this->getEditUrl( 'SetSiteLink', $item, null );
--
To view, visit https://gerrit.wikimedia.org/r/124332
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I91fb11ed1547b903a932ebcf62f7d57888c7d965
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Aude <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits