Jdlrobson has uploaded a new change for review.

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

Change subject: Wikidata descriptions should only be displayed in beta
......................................................................

Wikidata descriptions should only be displayed in beta

The existing config variable makes descriptions available and is enabled
on the cluster as true. This decouples them and fixes the browser tests
for when the flag is true in future.

Bug: T116756
Change-Id: I15d5631ec43e5832c1ac7d44d12768cf2c944a3b
---
M includes/MobileFrontend.hooks.php
M includes/config/Wikidata.php
M tests/browser/features/step_definitions/search_steps.rb
M tests/browser/features/support/pages/article_page.rb
4 files changed, 19 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/85/249585/1

diff --git a/includes/MobileFrontend.hooks.php 
b/includes/MobileFrontend.hooks.php
index b778f55..68fd56d 100644
--- a/includes/MobileFrontend.hooks.php
+++ b/includes/MobileFrontend.hooks.php
@@ -346,9 +346,19 @@
                        ) );
                }
 
+               // We need to check that first descriptions are enabled (the 
server admin has installed
+               // Wikidata) and then secondly that it is okay to display them 
prominently in the UI
+               // For instance a server admin may want to make them available 
in the page via JS for gadgets
+               // but not build them into their experience.
+               $displayDescriptions = $config->get( 
'MFDisplayWikibaseDescription' );
+               $useDescriptions = $config->get( 'MFUseWikibaseDescription' );
+
+               if ( $context->isBetaGroupMember() ) {
+                       $displayDescriptions = true;
+               }
                // When set turn on Wikidata descriptions
                // https://phabricator.wikimedia.org/T101719
-               if ( $config->get( 'MFUseWikibaseDescription' ) ) {
+               if ( $useDescriptions && $displayDescriptions ) {
                        if ( !in_array( 'pageterms', $pageProps ) ) {
                                $pageProps[] = 'pageterms';
                        }
diff --git a/includes/config/Wikidata.php b/includes/config/Wikidata.php
index 2542415..7e75009 100644
--- a/includes/config/Wikidata.php
+++ b/includes/config/Wikidata.php
@@ -12,6 +12,12 @@
 $wgMFUseWikibaseDescription = false;
 
 /**
+ * If set to true wikidata descriptions will be displayed in UI elements such 
as search,
+ * nearby and watchlist.
+ */
+$wgMFDisplayWikibaseDescription = false;
+
+/**
  * Define the property that holds a string representing a category on 
$wgMFPhotoUploadEndpoint
  */
 $wgMFWikibaseImageCategory = '';
diff --git a/tests/browser/features/step_definitions/search_steps.rb 
b/tests/browser/features/step_definitions/search_steps.rb
index 5f7592a..818899c 100644
--- a/tests/browser/features/step_definitions/search_steps.rb
+++ b/tests/browser/features/step_definitions/search_steps.rb
@@ -67,7 +67,7 @@
 end
 
 Then(/^search results should contain "(.+)"$/) do |text|
-  expect(on(ArticlePage).search_result_element.when_present.text).to eq text
+  expect(on(ArticlePage).search_result_heading_element.when_present.text).to 
eq text
 end
 
 Then(/^I should not see '#\/search' in URL$/) do
diff --git a/tests/browser/features/support/pages/article_page.rb 
b/tests/browser/features/support/pages/article_page.rb
index edec96d..39c0c12 100644
--- a/tests/browser/features/support/pages/article_page.rb
+++ b/tests/browser/features/support/pages/article_page.rb
@@ -58,6 +58,7 @@
   text_field(:search_box_placeholder, name: 'search', index: 0)
   text_field(:search_box2, name: 'search', index: 1)
   li(:search_results, css: '.search-overlay .page-list li')
+  h3(:search_results_heading, css: '.search-overlay .page-list li h3')
   div(:search_watchstars, css: '.search-overlay .page-list li 
.watch-this-article')
   div(:search_overlay, class: 'search-overlay')
   button(:search_overlay_close_button) do |page|

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I15d5631ec43e5832c1ac7d44d12768cf2c944a3b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: wmf/1.27.0-wmf.4
Gerrit-Owner: Jdlrobson <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to