Page MenuHomePhabricator

Discussion Tools causes TemplateStyles to be empty in certain cases
Closed, ResolvedPublic

Description

It looks like the current version of Discussion Tools causes TemplateStyles not to load properly in certain cases.

E.g. the welcome message Template:Hola on nl.wp uses TemplateStyles;

The pages 16–45 contain an empty <style data-mw-deduplicate="TemplateStyles:r56789563"></style> when Discussion Tools is enabled.


[1] The welcome message as it should look (:c):


[2] The welcome message without the TemplateStyles styling (:c):

Event Timeline

Marc created this task.Dec 12 2020, 11:26 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 12 2020, 11:26 PM
Marc added a comment.Dec 13 2020, 12:15 AM

The inserting of 'top-level' <span data-mw-comment="..."> elements may have something to do with the issue, but that's just my guess.
See also WP:SHEIC, the technical village pump on nl.wp (so in Dutch), for some discussion leading to this ticket.

Thanks for the bug report, and for the examples.

It looks like the problem occurs when there is a signature following the welcome template. This causes our code to treat it like any other comment, and insert the reply link into the page. The link also comes with two markers to indicate the start and end of a comment [1]. It looks like our code tries to insert the start marker inside of the <style> tag, which is not allowed in HTML, and which causes the contents of the tag to not be serialized into HTML at all. (We've recently had a similar issue caused by the end marker appearing inside of a <br> tag: T266288.)

[1] They look like this in HTML: <span data-mw-comment-start="c|Danielm|2004-08-22T21:10:00.000Z"></span> <span data-mw-comment-end="c|Danielm|2004-08-22T21:10:00.000Z"></span>

Change 649413 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/DiscussionTools@master] Fix trying to insert start/end markers in impossible locations

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

Change 649413 merged by jenkins-bot:
[mediawiki/extensions/DiscussionTools@master] Fix trying to insert start/end markers in impossible locations

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

matmarex edited projects, added Skipped QA; removed Patch-For-Review.

The fix will be included in this week's deployment on Thursday.

Marc added a comment.Dec 15 2020, 7:37 AM

Thanks for the quick investigation and fix!

ppelberg moved this task from Backlog to Triaged on the DiscussionTools board.Dec 15 2020, 4:56 PM

Meta: I'm going to check this on Friday, 18-Dec.

Meta: I'm going to check this on Friday, 18-Dec.

This seems to be working as expected to me. [i]

@Marc if you observe otherwise, please re-open this task.


ppelberg closed this task as Resolved.Dec 24 2020, 2:54 AM
ppelberg claimed this task.
Marc added a comment.Dec 27 2020, 12:49 PM

Ah yes, last week I noticed it works fine after the update (but forgot to mention it here). Thanks!

Ah yes, last week I noticed it works fine after the update (but forgot to mention it here). Thanks!

Excellent ^ _ ^

Bdijkstra reopened this task as Open.Sat, Feb 20, 12:06 AM
Bdijkstra added a subscriber: Bdijkstra.

Re-opened, it seems that a regression happened. Same symptom on some user pages: link 16 above looks fine to me, but not link 17.

Also noticed on huwiki: Szerkesztővita:Merkl.otto and Szerkesztővita:Merkl, on both pages the In memoriam… ({{gyász}}) template lacks styling.

I'm looking into it

matmarex closed this task as Resolved.Mon, Feb 22, 9:39 PM

I think it's a separate issue. The fix here is covered by unit tests and they're still passing, so it's not just a silly regression. The problem now occurs only on pages where a comment using TemplateStyles appears before any section headings. I don't know yet how we broke that but I'll investigate.

Filed a separate task: T275440: Discussion Tools causes TemplateStyles to be empty in certain cases on pages without section headings