Page MenuHomePhabricator

[betalabs] Notification about Mention on wikitext pages does not link to the section where Mention occurred if links, templates etc are present in section titles
Closed, ResolvedPublic

Description

Revised after @Catrope feedback:

  1. On a wikitext page create a topic with a template, or a link, or a javascript snippet in the title. The following samples were tested:
== Topic with <script>alert(1)</script> == 
== Topic with link [[Talk:ET1]] == 
== Topic with template {{release}} ==
  1. Mention user(s) in any of those topics e.g. [[User:ET34]] ~~~~

3.User:ET34 will receive a notification that he was mentioned - when User:ET34 clicks on the notification, he will be redirected to the top of the page not to the section where the mention was occurred.

The URL looks like the following, e.g. {{CURRENTTIME}} is present: http://en.wikipedia.beta.wmflabs.org/wiki/Mavetuna2#Should_be_redirected_here_.7B.7BCURRENTTIME.7D.7D

Event Timeline

Did you produce "00:22" with {{CURRENTTIME}}? Did the URL you got when following the mention contain #00:22 at the end or some other indication that we tried to send you to the section?

Etonkovidova renamed this task from [betalabs] Regression: Mention notification from wikitext pages does not link to the section where Mention occurred to [betalabs] Notification about Mention on wikitext pages does not link to the section where Mention occurred if links, templates etc are present in section titles.May 10 2016, 4:28 PM
Etonkovidova updated the task description. (Show Details)

It looks like we are using parsed-and-stripped section titles to generate anchor links, which is wrong. This causes us to produce incorrect (broken) anchor links when the section title contains basically any wikitext at all (bold, links, templates, etc.)

Change 312959 had a related patch set uploaded (by Catrope):
Fix links to sections with [[links]] in their title

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

The attached patch takes care of links, but not templates yet.

Change 312959 merged by jenkins-bot:
Fix links to sections with [[links]] in their title

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

Change 313136 had a related patch set uploaded (by Catrope):
Used parsed section titles for anchors

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

Change 313136 merged by jenkins-bot:
Used parsed section titles for anchors

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

Checked in betalabs for the test cases described in the ticket.

@Catrope
for topic title with {{CURRENTTIME}} e.g. == Current time template {{CURRENTTIME}} == the url will be: https://en.wikipedia.beta.wmflabs.org/wiki/Mavetuna58y#Current_time_template_21%3A45

Also, I re-checked T62396: Echo doesn't link to the correct section if there are duplicate section headings - the issue is still there: the straightforward scenario - 1) created two identical topic titles 2) mention the same user in both topics 3) a mentioned user receives two notifications - and both will be pointing to the most upper topic. Added comments to T62396: Echo doesn't link to the correct section if there are duplicate section headings

T67032: Echo notifications sometimes link to incorrect section has a complex case of mixing additional styling with user links, e.g.

'''[[User:Spinningspark|<font style="background:#fafad2;color:#C08000">Spinning</font>]][[User talk:Spinningspark|<font style="color:#4840a0">Spark</font>]]''' 07:56, 8 May 2014 (UTC)

which needs some additional investigation.