Page MenuHomePhabricator

Replying to comment with {{tracked}} template edge case (places reply in wrong location)
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue:

What happens?:

  • Reply is placed at the end of the bulleted list instead of as a reply to that bullet.
  • Reply is not part of the bulleted list (e.g. it used : instead of *)

What should have happened instead?:

  • Reply should be a subbullet of the originally selected bullet

Software version

Other information

Event Timeline

It's because of the {{tracked}} templates on that page, which look like un-indented comments to our software (it's not smart enough to read CSS, only the HTML page structure). Perhaps we should special-case them to not be considered as a part of comments, like we did for {{outdent}} templates.

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

[mediawiki/extensions/DiscussionTools@master] Ignore "tracked" templates at the beginning of comments

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

It's because of the {{tracked}} templates on that page, which look like un-indented comments to our software (it's not smart enough to read CSS, only the HTML page structure). Perhaps we should special-case them to not be considered as a part of comments, like we did for {{outdent}} templates.

Would it make sense to have a generic CSS class that can be used for these style of templates instead of specifically looking for outdent/tracked?

Change 818594 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] Ignore "tracked" templates at the beginning of comments

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

Would it make sense to have a generic CSS class that can be used for these style of templates instead of specifically looking for outdent/tracked?

Maybe, but I'm always hesitant about introducing new wikitext markup, plus all of the templates would have to be edited to include it. There are only 2 cases so far, so it didn't seem worth it, but it might be a good idea in the future.

all of the templates would have to be edited to include it. There are only 2 cases so far, so it didn't seem worth it

I have two more examples from huwiki: Másvita and Függőben. The former is quite rarely used, but when yes, it makes excerpts unusable due to its length; the second shouldn’t be used when starting new topics (it marks that a topic is not yet resolved, which is natural and obvious in case of a just-started topic), but it does get used every now and then. And it’s just one wiki out of hundreds. You can’t list all possible classes, and you shouldn’t either—wiki content should depend on software, not the other way round. Yes, all templates have to be edited to include the new class, but it’s way easier than creating Gerrit changes for all templates, not to mention that a class that designates a template that should be exempted on one wiki, may designate a template that should not be exempted on another.

I finally found some time to go back to this today.

@Ryasmeen Thank you for noticing that, it looks like we don't handle TemplateStyles preceding the template contents correctly. The next patch should fix this.

@Legoktm @Tacsipacsi I filed T324132: Finer control over which templates are treated as part of talk page comments as a follow-up based on your comments. I don't want to get into this right now, sorry.

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

[mediawiki/extensions/DiscussionTools@master] Add another test case for {{tracked}} template

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

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

[mediawiki/extensions/DiscussionTools@master] Improve handling for comment separators

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

matmarex renamed this task from Replying to bulleted list edge case (places reply in wrong location) to Replying to comment with {{tracked}} template edge case (places reply in wrong location).Nov 30 2022, 5:43 PM

Change 862308 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] Add another test case for {{tracked}} template

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

Change 862309 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] Improve handling for comment separators

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

matmarex removed a project: Editing QA.

Yeah, I'm also getting the wrong behavior on https://en.wikipedia.beta.wmflabs.org/wiki/Talk:T313097. :/ Thanks for catching this!

Curiously, the reply tool appears in the right place now, but the actual comments are posted in the wrong place still.

image.png (2×3 px, 496 KB)

The Parsoid output (https://en.wikipedia.beta.wmflabs.org/api/rest_v1/page/html/Talk%3AT313097) has some suspicious-looking output near the {{tracked}} transclusion:

<p about="#mwt2" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;Tracked&quot;,&quot;href&quot;:&quot;./Template:Tracked&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;T238025&quot;}},&quot;i&quot;:0}}]}" id="mwCg"><style data-mw-deduplicate="TemplateStyles:r555781" typeof="mw:Extension/templatestyles" about="#mwt4" data-mw="{&quot;name&quot;:&quot;templatestyles&quot;,&quot;attrs&quot;:{&quot;src&quot;:&quot;Tracked/styles.css&quot;}}">.mw-parser-output .tracked{float:right;clear:right;margin:0 0 1em 1em;width:12em;border:1px solid #72777d;border-radius:2px;background-color:#eaecf0;font-size:85%;text-align:center;padding:0.5em}.mw-parser-output .tracked-url{font-weight:bold}.mw-parser-output .tracked-closure{color:black;font-weight:bold;text-transform:uppercase}.mw-parser-output .tracked-resolved{color:green}</style><span about="#mwt4"><!--__DTHASLEDECONTENT__--><!--__DTEMPTYTALKPAGE__--></span></p>
matmarex added a project: Skipped QA.

(I hope this will be resolved by T328980)

With that fix applied, it's finally working as expected:

image.png (2×3 px, 836 KB)