Page MenuHomePhabricator

Notification: Dummy title used when section name is a magicword
Closed, ResolvedPublic

Description

Hi,
{F4312689}
It looks like == [[:{{BASEPAGENAME}}]] == section name do strange localisation of the mention in notifications.
Meet on https://fr.wikipedia.org/w/index.php?title=Discussion:OL_TV/Droit_d'auteur
Thanks you

Event Timeline

Mattflaschen-WMF renamed this task from Notification: bad localization when section name is a magicword to Notification: Dummy title used when section name is a magicword.Jul 27 2016, 9:13 PM

Confirmed in betalabs 1.28.0-alpha (b79a28c). The sample title when used as a section title on wikitext pages produces a dummy title.

Below is the screenshot when the sample title == [[:{{BASEPAGENAME}}]] == was used as a section title and as a topic title on wikitext page and Flow page topic. Flow topics handle it correctly.

Screen Shot 2016-07-28 at 11.13.00 AM.png (361×565 px, 80 KB)

Related to T129439: topic-title-plaintext content format to treat topic-title-wikitext as plain text.
Added the title sample to test cases for XSS test cases. Also see, T120324: XSS in Flow topic titles and T128062: Keep notification excerpts compact and meaningful for tested cases on Flow pages.

As @Mattflaschen-WMF says, this may just be a matter of ->plaintextParams(). If that's the case, let's just do this, but if it's a deeper problem around section support, let's put it off. There are other bugs around notifications and section handling and they're mostly due to sections not being very well supported in MediaWiki generally.

It's not about plaintextParams.

This is what DiscussionParser does:

echo MessageCache::singleton()->parse( '[[:{{BASEPAGENAME}}]]' )->getText();

<p><a href="/w/index.php?title=Badtitle/title_not_set_in_MessageCache::parse&amp;action=edit&amp;redlink=1" class="new" title="Badtitle/title not set in MessageCache::parse (page does not exist)">Badtitle/title not set in MessageCache::parse</a>
</p>

Oh, ugh, I see, that's terrible. We'd have to parse it using the correct title somehow.

Change 308115 had a related patch set uploaded (by Sbisson):
Provide title when parsing wikitext

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

Change 308115 merged by jenkins-bot:
Provide title when parsing wikitext

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

Checked the fix for Flow topic titles and wikitext section titles
Flow topics with == [[:{{BASEPAGENAME}}]] == will display it un-parsed, when wikitext pages will display it as as the page name link in a section title according to https://www.mediawiki.org/wiki/Help:Magic_words#Page_names
@SBisson should it be the same for Flow topics?

Screen Shot 2016-09-02 at 12.39.30 PM.png (396×559 px, 62 KB)