Page MenuHomePhabricator

Add wikidata item link to AMC overflow menu
Closed, ResolvedPublic5 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

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

ovasileva created this task.May 6 2019, 4:03 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 6 2019, 4:03 PM
ovasileva triaged this task as Normal priority.May 6 2019, 4:03 PM
Jony added a subscriber: Jony.May 7 2019, 6:24 AM
Jdlrobson updated the task description. (Show Details)May 8 2019, 4:25 PM
Jdlrobson updated the task description. (Show Details)
Jdlrobson updated the task description. (Show Details)May 8 2019, 4:28 PM
Jdlrobson updated the task description. (Show Details)May 8 2019, 4:35 PM
phuedx updated the task description. (Show Details)May 8 2019, 4:55 PM
phuedx set the point value for this task to 5.
phuedx updated the task description. (Show Details)
phuedx added a subscriber: phuedx.May 8 2019, 5:05 PM

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!

phuedx updated the task description. (Show Details)May 8 2019, 5:05 PM
ovasileva raised the priority of this task from Normal to High.May 20 2019, 2:55 PM
alexhollender updated the task description. (Show Details)Jun 5 2019, 5:20 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

pmiazga updated the task description. (Show Details)Jun 11 2019, 3:16 PM

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.

nray added a comment.Jun 13 2019, 5:21 PM

@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

pmiazga claimed this task.Jun 13 2019, 6:04 PM
pmiazga added a subscriber: nray.

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

pmiazga updated the task description. (Show Details)Jun 14 2019, 6:05 PM

@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.

pmiazga added a comment.EditedJun 14 2019, 7:02 PM

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 assigned this task to Edtadros.Jun 17 2019, 6:30 PM
Esc3300 removed a subscriber: Esc3300.Jun 18 2019, 4:54 PM

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

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

nray added a comment.Jun 18 2019, 11:45 PM

@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

✅ AC2: Test when Wikidata link is in menu

Edtadros reassigned this task from Edtadros to ovasileva.Jun 19 2019, 4:57 PM
Edtadros updated the task description. (Show Details)
Edtadros added a subscriber: Edtadros.

Truly excellent QA steps on this one.

ovasileva closed this task as Resolved.Jun 26 2019, 5:34 PM

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