Page MenuHomePhabricator

Reply added on the same wikitext line as an HTML comment
Closed, ResolvedPublic

Description

Reply was added on the same wikitext line as an HTML comment in this edit: https://ar.wikipedia.org/?diff=50689795

That diff is particularly difficult to make sense of due to mixed LTR and RTL text, so here's a simpler test case:

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

This might be caused by the fix for T257651: Reply tool messes up replying to users with signatures followed by html comments.

Event Timeline

@matmarex is the fix for this known and needs to be implemented or something that requires more discussion before we're ready for implementation?

I ask the above wondering where this belongs on the board.

Change 630674 had a related patch set uploaded (by Esanders; owner: Esanders):
[mediawiki/extensions/DiscussionTools@master] WIP Failing test case for standalone comment

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

Esanders subscribed.

We should be able to come up with a fix for this.

So there is a conflicting case here:

=== Learning more ===
The [[mw:VisualEditor on mobile|VisualEditor on mobile]] is a good place to learn more about the projects we are working on. The team wants to talk with you about anything related to editing. If you have something to say or ask, please leave a message at [[mw:Talk:VisualEditor on mobile|Talk:VisualEditor on mobile]].

[[mw:User:PPelberg (WMF)|PPelberg (WMF)]] ([[mw:User talk:PPelberg (WMF)|talk]]) and [[User:Whatamidoing (WMF)|Whatamidoing (WMF)]] ([[User talk:Whatamidoing (WMF)|talk]]) 21:24, 15 July 2019 (UTC)
<!-- Message sent by User:Whatamidoing (WMF)@enwiki using the list at https://en.wikipedia.org/w/index.php?title=Wikipedia:VisualEditor/Newsletter&oldid=901773265 -->

In this case the comment appears on a different line to the signature, and so "fixing" this issue would result in the comment being separated from the message. We could add a heuristic that one linebreak is acceptable, but not more than one. Generally there is no way for us to know if the comment is associated with the comment or not.

..."fixing" this issue would result in the comment being separated from the message. We could add a heuristic that one linebreak is acceptable, but not more than one. Generally there is no way for us to know if the comment is associated with the comment or not.

@Esanders: meaning, were we to not implement the heuristic you are suggesting above, a comment (call it COMMENT 2 ~~~~) posted using the Reply Tool would get inserted as such (see below)?

If yes, then let's do what you're suggesting: add a condition that allows for single linebreaks. Reason: I have not noticed a pattern of people inserting two line breaks in between the content of their comment and their signature (if others are aware of such a pattern, please say as much).


=== Learning more ===
The [[mw:VisualEditor on mobile|VisualEditor on mobile]] is a good place to learn more about the projects we are working on. The team wants to talk with you about anything related to editing. If you have something to say or ask, please leave a message at [[mw:Talk:VisualEditor on mobile|Talk:VisualEditor on mobile]].

[[mw:User:PPelberg (WMF)|PPelberg (WMF)]] ([[mw:User talk:PPelberg (WMF)|talk]]) and [[User:Whatamidoing (WMF)|Whatamidoing (WMF)]] ([[User talk:Whatamidoing (WMF)|talk]]) 21:24, 15 July 2019 (UTC)
: COMMENT 2 ~~~~
<!-- Message sent by User:Whatamidoing (WMF)@enwiki using the list at https://en.wikipedia.org/w/index.php?title=Wikipedia:VisualEditor/Newsletter&oldid=901773265 -->

Ed confirmed during standup that what is described in T264026#6500528 is accurate. We're going to implement what he proposed in T264026#6500279.

This seems a bit brittle, I feel like Parsoid should be taking care of these newlines and turning them into a paragraph. (That's what happens in the old parser, in fact.) But it also seems to be a intentional decision for Parsoid not to wrap HTML comments in paragraphs (judging by the behavior of other combinations of HTML comments and newlines), it's probably more sensible for article pages. I guess it's fine this way too.

Change 630674 merged by jenkins-bot:
[mediawiki/extensions/DiscussionTools@master] Ignore HTML comments which are more than two lines from a reply

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

This seems a bit brittle, I feel like Parsoid should be taking care of these newlines and turning them into a paragraph.

@matmarex, are you using "brittle" here to mean the following?

"Hardcoding" the one line break exception is overly specific, inflexible and as a result, likely to fail."

...if yes, can you think of a more flexible approach?

Yeah, Parsoid usually doesn't exactly preserve whitespace (see e.g. all the issues we're having with dirty diffs in reply tool), so while this works now, I would not be surprised if its behavior changed some day. But I can't really think of a better approach.

Yeah, Parsoid usually doesn't exactly preserve whitespace (see e.g. all the issues we're having with dirty diffs in reply tool), so while this works now, I would not be surprised if its behavior changed some day. But I can't really think of a better approach.

Roger that, okay. We continue with https://gerrit.wikimedia.org/r/630674 then.