Page MenuHomePhabricator

Comment not recognized for no obvious reason
Closed, ResolvedPublicBUG REPORT

Assigned To
Authored By
Tacsipacsi
May 16 2022, 2:52 PM
Referenced Files
F35194087: Screenshot 2022-05-31 at 18.27.43.png
May 31 2022, 5:28 PM
F35146188: image.png
May 16 2022, 9:18 PM
F35146164: image.png
May 16 2022, 9:14 PM
F35146155: image.png
May 16 2022, 9:10 PM
F35145754: image.png
May 16 2022, 4:59 PM
F35145752: image.png
May 16 2022, 4:59 PM
F35145652: image.png
May 16 2022, 4:10 PM

Description

Steps to reproduce

  1. Open https://commons.wikimedia.org/w/index.php?title=Template_talk:Translation_table&oldid=656448046&dtdebug=1#Problem_with_template
  2. Look at the comments.

Actual results

  1. DiscussionTools recognizes two comments, one written by Pierre cb, and one written by me, the latter containing Raymond’s comment as well.

Expected results

  1. DiscussionTools recognizes three comments, one by Pierre cb, one by Raymond and one by me.

Additional information

The first two comments both use {{unsigned}}. If neither of them would be recognized, I’d think the template is somehow broken. The puzzling is that one of them is recognized, and only the other one isn’t. By the way, the debug mode looks really nice! 🙂

Event Timeline

On the Wikidata Project chat I just happened to notice another comment that’s recognized as part of a reply to it; the unrecognized comment is again unsigned, but this time on the top level:

image.png (249×1 px, 125 KB)

It might be related to “unsigned” templates after all, even if it doesn’t always happen?

The unrecognized comment has a left-to-right mark after the time: (https://en.wikipedia.org/wiki/Left-to-right_mark)

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

The recognized one does not:
image.png (2×3 px, 366 KB)

We should probably support this. We already handle them appearing after the date (see T245784).

Thanks for the tip, it makes sense: I copied the second timestamp from the page history (only the time part, as I use Hungarian interface, so the date part would have been of no use), while I decided to retype the first one. To support already-existing such unsigned templates, it would be useful to remove all LTR/RTL marks from the text before recognizing the timestamps, but to prevent new ones, I think the page history shouldn’t contain them in the first place; incorrect positioning should be prevented at the HTML (<bdi>) / CSS (unicode-bidi) level instead.

For reference, here's a history page with the LRMs marked:

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

Generated using:

lrm = '\u200E';
treeWalker = document.createTreeWalker(
	document.body,
	NodeFilter.SHOW_TEXT,
	function ( node ) {
		if ( node.textContent.indexOf( lrm ) !== -1 ) {
			return NodeFilter.FILTER_ACCEPT;
		}
		return NodeFilter.FILTER_SKIP;
	},
	false
);
while ( node = treeWalker.nextNode() ) {
	newNode = node.splitText( node.textContent.indexOf( lrm ) );
	treeWalker.currentNode = newNode.splitText( 1 );
	wrap = document.createElement( 'span' );
	wrap.style.cssText = 'outline: 1px solid red; outline-offset: 3px;';
	newNode.parentNode.insertBefore( wrap, newNode );
	wrap.appendChild( newNode );
}

…and the same in Hungarian:

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

This explains how you ended up with the LRM there, it's because the time is at the end in the date format used in Hungarian. It was probably obvious to you, but very confusing to me.

On the Wikidata Project chat I just happened to notice another comment that’s recognized as part of a reply to it; the unrecognized comment is again unsigned, but this time on the top level:

image.png (249×1 px, 125 KB)

It might be related to “unsigned” templates after all, even if it doesn’t always happen?

This is actually a different problem – the date format for the unsigned comment is incorrect (different than in normal signatures) – "May 16, 2022‎" instead of "16 May 2022". (And there's also a stray LRM, but it should be harmless here.)

By the way, if you enable syntax highlighting, it will mark LRMs and other invisible characters:

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

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

[mediawiki/extensions/DiscussionTools@master] Ignore LRM and RLM in more places in the timestamp

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

Change 792295 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] Ignore LRM and RLM in more places in the timestamp

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