Page MenuHomePhabricator

CX draft fetching: Align response payload with UI needs
Closed, ResolvedPublic

Description

Background: When the CX desktop editor loads, the "page" URL parameter is always set. During editor initialization, a request is being sent to fetch the draft translation for the given page, if one exists for the current user. If no draft exists, the backend checks for conflicting translations. If such translation is found, the UI should be notified, in order to block this translation. Finally, if neither a draft nor a conflicting translation has been found, nothing is returned. The UI is handling this case as new translation.

The issue: In the case of conflicting translation, the whole translation is still being returned, even if it's not needed in the UI. On the other hand, the "translatorName" and the "translatorGender" properties are also returned for draft translations, while they are only needed when a conflict exists (that means no draft has been found for the current user).

This task proposes to align the returned payload with the needed information in the client side, for smaller responses and more-straightforward implementation.

Event Timeline

Change 964024 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] CX draft fetching: Align response payload with UI needs

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

ngkountas triaged this task as Medium priority.Oct 10 2023, 6:19 PM
ngkountas added a project: ContentTranslation.

Change 964024 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX draft fetching: Align response payload with UI needs

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

ngkountas changed the task status from Open to In Progress.Nov 7 2023, 3:26 PM

Change 971911 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] Fix conflicting translation case

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

Change 971911 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX draft restoration: Fix conflicting translation case

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

Change 974257 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] CX fetch desktop draft: Use formatversion 2 to properly get booleans

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

Change 974257 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX fetch desktop draft: Use formatversion 2 to properly get booleans

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

The translation is not returned any more for conflicting translations, just the translatorName, the translatorGender and the hasConflicts (set to true) properties are returned in the payload:

image.png (954×1 px, 382 KB)

Additionally, translatorName and translatorGender are no longer being returned for properly restored drafts:

image.png (993×1 px, 412 KB)

Based on the above, I believe we can close this task as done.