Page MenuHomePhabricator

Inline diff: one or more lines added or deleted
Closed, ResolvedPublic5 Estimated Story Points

Description

Introduced annotation that represent when one or more lines are added or deleted.

Feature Summary

On the current experience, instead of just displaying the paragraph split, the diff looks like an entire chunk of text was deleted and then added back. Also, if there’s a word change inside the paragraph that has been split, the change isn’t highlighted/noted anywhere. This error could lead to cases of vandalism that might be overlooked.

Use cases

  • As a viewer of the Inline Diff diff on Desktop: I am able to recognize when a new line or multiple new lines are added.
  • As a viewer of the Inline Diff diff on Desktop: I am able to see a visual marker to show when a word changed within a paragraph that was split up as its own paragraph.
  • As a viewer of the Inline Diff diff on Desktop: I am able to recognize when a line or multiple lines are deleted.

Benefits

All users of the diff view will better understand when a paragraph has been split, rather than text being deleted and re-added.

Details for QA

  • Add test coverage for existing functionality, if missing
  • Acceptance Criteria: This change must ensure "functionality parity" in all other diff stress tests
  • Make sure markup/css changes to wikidiff do not break PHP engine output

Designs and details

One New line (pressing enter once)
The action of pressing enter once will be represented with the "newline" blue highlighted text.

Screenshot from 2023-07-11 09-55-52.png (167×638 px, 20 KB)

More than one new line - paragraph split (pressing enter more than once)
The action of pressing more than once:

  • The first enter will be represented with the blue highlighted text: "newline"
  • The additional enters will be represented a new line representing the addition of a new line and text "newline" highlighted in blue.

Screenshot from 2023-07-07 14-03-22.png (175×629 px, 22 KB)

One or more lines deleted (pressing backspace or delete multiple times)
The action of pressing backspace or delete multiple times will be represented with the "deleted" yellow highlighted text.

Screenshot from 2023-07-11 09-57-59.png (165×670 px, 21 KB)

Related Conversations

https://phabricator.wikimedia.org/T327645

Event Timeline

dmaza set the point value for this task to 5.Apr 19 2023, 2:46 PM
dmaza moved this task from Needs Discussion to Up Next (May 20-June 3) on the Community-Tech board.

@JSengupta-WMF The mockups for the inline format have been updated since we created this task. I just want to confirm that the markers for new and deleted should be as shown as in this figma screenshot:

Screenshot from 2023-07-07 14-03-22.png (175×629 px, 22 KB)

Change 936340 had a related patch set uploaded (by HMonroy; author: HMonroy):

[mediawiki/core@master] diff: Add new or deleted line markers

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

@HMonroy yes the newline and delete markers in your screenshot are the latest ones.

HMonroy updated the task description. (Show Details)

Change 936340 merged by jenkins-bot:

[mediawiki/core@master] diff: Add new or deleted line markers

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

I'm wondering about how should "⟵ delete" and "↲ newline" be translated into right to left languages.

Usually, I flip the arrows when translating to Hebrew and recommend that translators to Arabic, Persian, etc., do the same.

But in this case, I guess that they are supposed to look similar to the "⟵ Delete" (a.k.a. "⟵ Backspace") and "↲ Enter" (a.k.a. "↲ Return") key on common physical keyboards. And as far as I know, these keyboard keys always show arrows that point to the left, even on keyboards that are sold in countries where right-to-left languages are spoken. (My laptop's keyboard doesn't have any arrows at all, but many keyboards do.)

So my intuition about translating these messages is that the same left-pointing arrows should be used in the translations, and they should be visually on the left end of the translation (that is, in RTL languages they will be in the end of the string and not in the beginning).

Am I overthinking it? :)

@Amire80 you are right and thanks for bringing this up. I checked a number of keyboards from different manufacturers online and looks like even for RTL languages some symbols are universal such as Enter and Backspace. So let's go with what you proposed i.e. translated text but the arrows pointing to the left and at the end of the string.

Screenshot from 2023-07-11 09-57-59.png (165×670 px, 21 KB)

@JSengupta-WMF I don't believe it is possible to get a "<- delete" at the end of a paragraph, like shown in the above screenshot.

Rev A:

foo bar

Rev B:

foo

bar
Rev A > Rev BRev B > Rev A
maxSplitSize = 1
a_to_b_mss1.png (89×100 px, 2 KB)
b_to_a_mss1.png (86×89 px, 2 KB)
maxSplitSize > 1
a_to_b_mss3.png (81×123 px, 1 KB)
b_to_a_mss3.png (87×89 px, 2 KB)
Mobile

The same makers will appear on mobile, but the colours don't match the red/green colour scheme:

mobile_newline_delete_markers.png (504×1 px, 96 KB)

RTL

Example of the markers on arwiki. Is this what you were thinking of, @JSengupta-WMF?

arwiki_delete_marker.png (75×142 px, 3 KB)

arwiki_newline_marker.png (81×169 px, 4 KB)

Copy and pasting

Newlines don't get copied:

enwiki beta:

foobar foobar foobar
foobaz foobaz foobaz

testwiki:

foobar foobar foobar
 
foobaz foobaz foobaz

There's report on wiki (https://en.m.wikipedia.org/wiki/Wikipedia:Village_pump_(technical)) that the behaviour on mobile has changed. Could you please take a look? the styles on core are shared with that page.

This current diff has spaces between lines (compare with screenshot above)
https://en.m.wikipedia.org/wiki/Special:MobileDiff/1166429149

Screenshot_20230721_121337_Chrome.jpg (2×1 px, 745 KB)

Extra note: I see no mocks or QA steps in this ticket for mobile. Please always include QA At this point mobile and desktop code are more or less the same with only a few exceptions so please always check both views in all of your tasks. If you don't do this I personally get pinged on a wiki somewhere when something breaks.

Edit: Is this T342158 ?

Extra note: I see no mocks or QA steps in this ticket for mobile. Please always include QA At this point mobile and desktop code are more or less the same with only a few exceptions so please always check both views in all of your tasks. If you don't do this I personally get pinged on a wiki somewhere when something breaks.

We regularly test mobile diffs, as well as many other types of diffs and places where diffs are shown. We were aware of this issue and were discussing it internally.

There's report on wiki (https://en.m.wikipedia.org/wiki/Wikipedia:Village_pump_(technical)) that the behaviour on mobile has changed. Could you please take a look? the styles on core are shared with that page.

This current diff has spaces between lines (compare with screenshot above)
https://en.m.wikipedia.org/wiki/Special:MobileDiff/1166429149

Screenshot_20230721_121337_Chrome.jpg (2×1 px, 745 KB)

Looks like this was resolved now as part of T327645: Inline Diff: Insert/delete introduce line breaks, and the white gaps between green/red lines will be gone. I added screenshots there.

Permanent link to the on-wiki discussion: https://en.wikipedia.org/w/index.php?title=Wikipedia:Village_pump_(technical)&oldid=1166964553#Not_digging_the_new_mobile_diffs

I have nothing more to add to T330247#9015327. Testing of the more recent issue will continue with T327645.