Page MenuHomePhabricator

Add wikidata item link to AMC overflow menu
Closed, ResolvedPublic5 Estimated Story Points

Description

AC

  • Add wikidata link to overflow menu (above the "Cite page" link)
  • Selecting the wikidata item link will navigate to the wikidata item page
  • If no wikidata item is available, the link should not appear

Dev notes

  • Link should look something like: https://www.wikidata.org/wiki/Q5296
  • Use the Sidebar toolbox link injected via BaseTemplateToolbox hook
  • There's no need for additional feature flagging. We're not planning on enabling AMC on wikidatawiki any time soon so there's no need to worry about Wikidata entities linking to themselves right now
  • See T222630#5167983 for a note on setting up a development environment

Sign off notes

  • The code shouldn't rely on Wikibase classes/hooks in any way. It can use only links injected into the Template object.

Design

image.png (1×1 px, 688 KB)

QA Instructions

Test when Wikidata link in not in menu
Test when Wikidata link is in menu

QA Results

ACStatusDetails
1T222630#5269125
2T222630#T222630

Event Timeline

Jdlrobson updated the task description. (Show Details)
phuedx set the point value for this task to 5.
phuedx updated the task description. (Show Details)

Setting up a development environment could be as trivial as adding the following to MobileFrontendHooks::onOutputPageParserOutput:

$outputPage->setProperty( 'wikibase_item', 'Q1234567890' );

That being said, if you want a working Wikibase installation, then you should go ahead and set it up!

ovasileva raised the priority of this task from Medium to High.May 20 2019, 2:55 PM

Change 516282 had a related patch set uploaded (by Nray; owner: Nray):
[mediawiki/extensions/Wikibase@master] Add wikidata link to Minerva overflow menu

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

Change 516447 had a related patch set uploaded (by Nray; owner: Nray):
[mediawiki/skins/MinervaNeue@master] Add wikidata link to overflow menu

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

Instead of adding new Hook handler to the Wikibase Client we will use the link injected into the Sidebar. Wikibase client already uses the BaseTemplateToolbox hook to inject Wikidata link. There is no need to implement another hook, to add the same thing just in different option.

Because we're not touching the Wikibase, the AC:

this is an opportunity to migrate the ExtMobileFrontend::getWikibaseDescription to Wikibase

was a pretty big scope creep, and it shouldn't be worked in this task.

I created new ticket T225529: Article tagline should be set by a hook, not by code highly coupled with Wikibase to remove existing hard dependency on Wikibase - removal of ExtMobileFrontend::getWikibaseDescription() and ExtMobileFrontend::getWikibaseEntity() methods in favor of calling a hook to fetch the tagline.

This ticket is only about adding new menu entry by fetching link added to the Sidebar.

Change 516282 abandoned by Nray:
Add wikidata link to Minerva overflow menu

Reason:
In favor of
I280537c6b8b32036d68a5a004571bb5a41c2e703

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

@alexhollender To clarify, should this link only be added to the overflow menu in the main namespace? Or should it also be added to the user namespace overflow menu as well if the wiki supports it? I believe the namespaces that wikibase client can work are configurable [1]

[1] https://www.mediawiki.org/wiki/Wikibase/Installation/Advanced_configuration#namespaces

@nray I didn't realize that wikidata items could show up on user pages. I'd say the priority here is main namespace pages, though the ultimate goal would be parity with desktop. Not sure how much scope that would add.

In T222630#5256649, @alexhollender wrote:

@nray I didn't realize that wikidata items could show up on user pages. I'd say the priority here is main namespace pages, though the ultimate goal would be parity with desktop. Not sure how much scope that would add.

I think it would be a 1 line addition to enable it on the user namespace, but I'm fine with punting on it for now as the use case seems like it might be pretty low

Change 516447 merged by jenkins-bot:
[mediawiki/skins/MinervaNeue@master] Add wikidata link to overflow menu

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

Change 517105 had a related patch set uploaded (by Pmiazga; owner: Pmiazga):
[mediawiki/skins/MinervaNeue@master] Hygiene: rename $navUrls to $toolbox

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

Change 517105 merged by jenkins-bot:
[mediawiki/skins/MinervaNeue@master] Hygiene: rename $navUrls to $toolbox

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

@alexhollender @nray I don't think we should show wikidata link on the usernamespace - if required we can add it later. As @nray pointed, it's one line change.

QA is blocked on availability of pverflow menu on the beta cluster.
Once deployed to test prod, could be tested on testwiki: https://test.m.wikipedia.org/wiki/Wikidata

@nray just noticed that the wikidata icon is black instead of #54595d.

Screen Shot 2019-06-18 at 2.57.55 PM.png (598×538 px, 97 KB)

Not sure how we usually do the color shift, but here is a gray version of the SVG:

Change 517762 had a related patch set uploaded (by Nray; owner: Nray):
[mediawiki/skins/MinervaNeue@master] Correct Wikidata icon color in overflow menu

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

@alexhollender you're right. The above ^^ patch should fix the color, but it unfortunately introduces some tech debt in the process as it makes it differ from the default OOUI icon structure which sets an explicit black stroke color on the icon. We'll see what the other devs think as well , but it might not be as clean/straightforward as one would think/hope :(

Change 517762 merged by jenkins-bot:
[mediawiki/skins/MinervaNeue@master] Correct Wikidata icon color in overflow menu

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

Test Result

Status: ✅ PASS
OS: macOS Mojave
Browser: Chrome
Device: MBP
Emulated Device: iPhoneX

Test Artifact(s):

QA Instructions

✅ AC1: Test when Wikidata link in not in menu

T222630-1.png (2×1 px, 390 KB)

✅ AC2: Test when Wikidata link is in menu

T222630-2.png (2×1 px, 400 KB)

T222630-3.png (2×1 px, 209 KB)

Edtadros updated the task description. (Show Details)
Edtadros added a subscriber: Edtadros.

Truly excellent QA steps on this one.

looks good, resolving. will do another check on production once the train is out.