Page MenuHomePhabricator

Integrate redlinks transform on Android
Closed, ResolvedPublic1 Estimated Story Points

Description

Note from @Mhurd:

Is there a benefit to using createDocumentFragment() on Android? This might be a noticeable performance gain and the redlinks transform is configured to support it. Change the following in sections.js to createDocumentFragment() instead of createElement():

var content = document.createElement( "div" );
var heading = document.createElement( "h" + ( section.toclevel + 1 ) );

And maybe reparent at the end of the method.

To test the transform, just make a link to a nonexistant page. Monte set up a test page on testwiki.

Event Timeline

Niedzielski set the point value for this task to 1.

I did not use a DocumentFragment as we perform this transform in a detached Document that is separate from window.document.

Change 366744 had a related patch set uploaded (by Niedzielski; owner: Sniedzielski):
[apps/android/wikipedia@master] Hygiene: integrate page-library red links transform

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

Change 366744 merged by jenkins-bot:
[apps/android/wikipedia@master] Hygiene: integrate page-library red links transform

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

RHo subscribed.

I would expect the red link to show up as red (Red50 #DD3333) so as a signifier before the user taps on the link.

"named" is shown as a blue link
main-MainActivity-08082017203322.png (1×1 px, 144 KB)
Non-existent "named" link tapped
main-MainActivity-08082017202827.png (1×1 px, 91 KB)

@RHo It;s possible that the behavior of the content service / API on Test Wiki may be slightly different from production Wikipedia. If you try a real article on Wikipedia, e.g. [[List of Boletus species]], you'll notice that red links are correctly stripped.

In case you want to check, the setting to force the old MediaWiki backend is under dev settings:

  • Enable useRestbase_setManually
  • Disable useRestbase
  • Restart the app to be safe

It appears to be working on my device.

@Dbrant - ah I'm a bit confused :o
@Niedzielski can you clarify that this task is meant to strip red links of link styling entirely? If so, the Test Wiki page mentioned does not do so.

The red links should be stripped (appear as text) and be unlinked (not clickable).

screenshot-2017-08-08-13-56-45-684522946.png (2×1 px, 150 KB)

screenshot-2017-08-08-13-56-38-457027609.png (2×1 px, 451 KB)

@Niedzielski - cool, was missing the steps to force the old MediaWiki backend first.

QA Testing steps

To do before test steps:

In case you want to check, the setting to force the old MediaWiki backend is under dev settings:

  • Enable useRestbase_setManually
  • Disable useRestbase
  • Restart the app to be safe
  1. Go to the article Bird4 from Test Wikipedia.
  2. Look at the first paragraph of text, it is expected that the first should have no links.

@RHo & @Niedzielski, I can't seem to get this working. I have enabled dev mode and enabled useRestbase_setManually and disabled useRestbase, but I cannot seem to get the Bird4 article to load. It just pushes me to the Birds article. Do you have any suggestions for reproduction?

hi @ABorbaWMF - hmm perhaps check that you're searching for the article set to using the 'Test' wikipedia language.
Alternatively, tap to open this link https://test.m.wikipedia.org/wiki/Bird4 from within your browser and choose to have it open in app.

Thanks @RHo. I didn't know about the test language. That's cool.

This one looks good. Ready for sign-off