Page MenuHomePhabricator

class="mw-redirect" for Special:PrefixIndex
Closed, ResolvedPublic

Description

[[Special:PrefixIndex]] should also contain class="mw-redirect" for redirects like [[Special:AllPages]].

Example:

https://www.mediawiki.org/w/index.php?title=Special:PrefixIndex&prefix=A
contains
<a title="AFT" href="/wiki/AFT">AFT</a>

https://www.mediawiki.org/w/index.php?title=Special:AllPages&from=A
contains
<a title="AFT" class="mw-redirect" href="/wiki/AFT">AFT</a>


Version: 1.20.x
Severity: enhancement

Details

Reference
bz37452

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 12:24 AM
bzimport set Reference to bz37452.

patriciomolina wrote:

includes/specials/SpecialPrefixindex.php uses Linker::linkKnown() (which has
"noclasses" in their structure) instead of Linker::link()

https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/core.git;a=blob;f=includes/specials/SpecialPrefixindex.php;h=730969df03bd2f282bc091421e45aa2ff6dee306;hb=master#l197

Does anybody know why linkKnown() is used instead of link()?

That avoids an extra db query to check if the file exists or not.

You can add that class to the $customAttribs depending on $s->page_is_redirect

Patch submitter? Where's the patch?
Do you mean you're working on it and going to provide a patch?

patriciomolina wrote:

I received this notification: https://integration.mediawiki.org/ci/job/MediaWiki-Tests-Parser/2051/

ParserTests::testParserTest with data set #470 ('Special page transclusion', '{{Special:Prefixindex/Xyzzyx}}', '<table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
', '', '')
Special page transclusion
Failed asserting that two strings are equal.

  • Expected

+++ Actual
@@ @@
-'<table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
+'<table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx" class="mw-redirect">Xyzzyx</a></td></tr></table>

I think we should change the expected string in order to satisfy this unit test.

(In reply to comment #4)

Patch submitter? Where's the patch?
Do you mean you're working on it and going to provide a patch?

I meant Patricio Molina were working on this issue and submitted code through gerrit.

Sorry, I saw

What    |Removed                     |Added

Status|NEW                         |ASSIGNED
    CC|                            |dereckson@<email>

and thought you were assigning it to yourself.
(patricio had already placed himself as assignee before)

I think we should change the expected string in order to satisfy this unit
test.

Yes. Change it in tests/parser/parserTests.txt, and resubmit the amended changeset including that file.

Also note, your patch is wrong in that it is adding mw-redirect to all links, not only to those that are redirects.

patriciomolina wrote:

(In reply to comment #10)

Also note, your patch is wrong in that it is adding mw-redirect to all links,
not only to those that are redirects.

Thanks! I didn't notice that. I've added a condition to apply that class only to redirects.

It wasn't necessary to change the test case.