Page MenuHomePhabricator

Unlabelled external links disappear in visual editor
Closed, ResolvedPublicBUG REPORT

Assigned To
Authored By
matej_suchanek
Oct 22 2022, 11:37 AM
Referenced Files
F35635493: Screenshot 2022-10-26 at 23.09.28.png
Oct 26 2022, 10:11 PM
F35621336: image.png
Oct 24 2022, 4:56 PM
F35621344: image.png
Oct 24 2022, 4:56 PM
F35621333: image.png
Oct 24 2022, 4:56 PM
F35621340: image.png
Oct 24 2022, 4:56 PM
F35611688: image.png
Oct 22 2022, 6:51 PM
F35610897: obrazek.png
Oct 22 2022, 11:37 AM
F35610889: obrazek.png
Oct 22 2022, 11:37 AM

Description

Steps to replicate the issue (include links if applicable):

  • Edit a page with unlabelled external links using the visual editor.

What happens?:

The links are invisible.

What should have happened instead?:

The links are visible so that they are not removed unintentionally.

Other information (browser name/version, screenshots, etc.):

ArticleVisual editor
obrazek.png (885×879 px, 115 KB)
obrazek.png (925×904 px, 109 KB)

Event Timeline

Looks like a bug in our data model.

In Parsoid output, the links are there: https://cs.wikipedia.org/api/rest_v1/page/html/Valorant/21790077

But they don't appear on the editable surface (they're not invisible, they're just not there). In VE debug mode (https://cs.wikipedia.org/wiki/Valorant?debug=2&veaction=edit), if you scroll ot the bottom and click "Show model", you can find some removableAlienMeta nodes instead (normally used to represent "useless" markup like <b></b> with nothing inside the tag) that seem to correspond to the missing links.

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

I think this is something we overlooked in T315209. The addition of nofollow to links in Parsoid output causes them not to be recognized. Setting ve.dm.MWNumberedExternalLinkNode.static.allowedRdfaTypes = null; before loading the editor fixes the problem. (It's already set on ve.dm.MWExternalLinkAnnotation, which is why normal labelled external links are not broken.)

matej_suchanek renamed this task from Unalbelled external links disappear in visual editor to Unlabelled external links disappear in visual editor.Oct 22 2022, 7:23 PM

Change 848434 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/VisualEditor@master] Allow 'nofollow' on external links in Parsoid output

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

I noticed that the same nofollow problem also causes incorrect handling for PMID and RFC magic links (they're treated as normal external links instead), this is also fixed by the patch. This can be tested on https://www.mediawiki.org/wiki/Help:Magic_links?veaction=edit.

IncorrectCorrect
image.png (960×3 px, 221 KB)
image.png (960×3 px, 231 KB)
image.png (960×3 px, 221 KB)
image.png (960×3 px, 215 KB)
(note: RFC links need a second patch too: https://gerrit.wikimedia.org/r/848435)

Change 848435 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/VisualEditor@master] ve.dm.MWMagicLinkNode: Fix matching RFC magic links

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

Change 848434 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Allow 'nofollow' on external links in Parsoid output

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

This bug is definitely on me, I should have realized that this will be a problem when reviewing @ihurbain's patches for T315209. I probably missed this because it works correctly for the normal external links, because we already had allowedRdfaTypes = null on them for unrelated reasons.

Change 848390 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/VisualEditor@wmf/1.40.0-wmf.6] Allow 'nofollow' on external links in Parsoid output

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

Change 848390 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@wmf/1.40.0-wmf.6] Allow 'nofollow' on external links in Parsoid output

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

Mentioned in SAL (#wikimedia-operations) [2022-10-24T20:21:05Z] <urbanecm@deploy1002> Started scap: Backport for [[gerrit:848390|Allow 'nofollow' on external links in Parsoid output (T321437)]], [[gerrit:848391|Retry without RESTBase when the page/revision seems to be missing (T315688)]]

Mentioned in SAL (#wikimedia-operations) [2022-10-24T20:21:24Z] <urbanecm@deploy1002> urbanecm and matmarex: Backport for [[gerrit:848390|Allow 'nofollow' on external links in Parsoid output (T321437)]], [[gerrit:848391|Retry without RESTBase when the page/revision seems to be missing (T315688)]] synced to the testservers: mwdebug1002.eqiad.wmnet, mwdebug2002.codfw.wmnet, mwdebug2001.codfw.wmnet, mwdebug1001.eqiad.wmnet

Mentioned in SAL (#wikimedia-operations) [2022-10-24T20:27:44Z] <urbanecm@deploy1002> Finished scap: Backport for [[gerrit:848390|Allow 'nofollow' on external links in Parsoid output (T321437)]], [[gerrit:848391|Retry without RESTBase when the page/revision seems to be missing (T315688)]] (duration: 06m 38s)

@matmarex depending on the links/the config, these external links can also have noreferrer noopener - should that patch be amended to also support that?

Change 849194 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/VisualEditor@master] Allow more 'rel' values on external links in Parsoid output

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

Change 848435 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] ve.dm.MWMagicLinkNode: Fix matching RFC magic links

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

Change 849194 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Allow more 'rel' values on external links in Parsoid output

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

EAkinloose subscribed.

✅ Unlabelled external links displays as expected in visual editor

Screenshot 2022-10-26 at 23.09.28.png (1×2 px, 457 KB)