Currently, the contenttranslation list endpoint for the query action is used in 6 different cases:
The contenttranslation list exposes several optional parameters and the results that are being returned in each request, depend on some combination of the given request parameters. These parameters are supposed to provide some versatility in this query action, but in fact the caller must be aware of the specific combination they need to provide, in order to fetch the translations for a specific scenario.
A very indicative example of this complexity is the case no. 5, where when a registered user sends a request with the "sourcetitle", "sourcelanguage" and "targetlanguage" params, the response may contain a draft translation (if such translation is found for the current user) or a conflicting translation. On the other hand, for the cases no. 2 and no. 6, where only the "translationid" parameter is passed to the request, a draft translation, the translation corpora units and the target categories are returned. These differences in the response payloads cannot be anticipated by an unsuspected caller, and thus there is no added versatility through the several exposed parameters.
Based on the above analysis, in order to provide a clearer interface for the identified usecases, and avoid the complexity of all the different combinations, this task proposes the introduction of a usecase parameter that will support the translation retrieval for each one of the 5 usecases presented above. For now, we can continue to support the old combinations too, for backward compatibility, if it's needed.
Change 964863 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):
[mediawiki/extensions/ContentTranslation@master] CX contenttranslation list: Add "usecase" parameter
https://gerrit.wikimedia.org/r/964863
Change 964863 merged by jenkins-bot:
Change 969073 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):
[mediawiki/extensions/ContentTranslation@master] CX3 Build 0.2.0+20231026
https://gerrit.wikimedia.org/r/969073
Change 969073 merged by jenkins-bot:
Change 968776 had a related patch set uploaded (by KartikMistry; author: Nik Gkountas):
[mediawiki/extensions/ContentTranslation@wmf/1.42.0-wmf.2] CX3 Build 0.2.0+20231026
https://gerrit.wikimedia.org/r/968776
Change 968777 had a related patch set uploaded (by KartikMistry; author: Nik Gkountas):
[mediawiki/extensions/ContentTranslation@wmf/1.42.0-wmf.1] CX3 Build 0.2.0+20231026
https://gerrit.wikimedia.org/r/968777
Change 968777 merged by jenkins-bot:
Mentioned in SAL (#wikimedia-operations) [2023-10-26T13:31:10Z] <lucaswerkmeister-wmde@deploy2002> Started scap: Backport for [[gerrit:968777|CX3 Build 0.2.0+20231026 ( T348563 T308836 )]]
Mentioned in SAL (#wikimedia-operations) [2023-10-26T13:32:30Z] <lucaswerkmeister-wmde@deploy2002> lucaswerkmeister-wmde and kartik: Backport for [[gerrit:968777|CX3 Build 0.2.0+20231026 ( T348563 T308836 )]] synced to the testservers ( https://wikitech.wikimedia.org/wiki/Mwdebug )
Mentioned in SAL (#wikimedia-operations) [2023-10-26T13:45:58Z] <lucaswerkmeister-wmde@deploy2002> Finished scap: Backport for [[gerrit:968777|CX3 Build 0.2.0+20231026 ( T348563 T308836 )]] (duration: 14m 48s)
Change 968776 merged by jenkins-bot:
Mentioned in SAL (#wikimedia-operations) [2023-10-26T14:38:16Z] <lucaswerkmeister-wmde@deploy2002> Started scap: Backport for [[gerrit:968776|CX3 Build 0.2.0+20231026 ( T348563 T308836 )]]
Mentioned in SAL (#wikimedia-operations) [2023-10-26T14:39:36Z] <lucaswerkmeister-wmde@deploy2002> kartik and lucaswerkmeister-wmde: Backport for [[gerrit:968776|CX3 Build 0.2.0+20231026 ( T348563 T308836 )]] synced to the testservers ( https://wikitech.wikimedia.org/wiki/Mwdebug )
Mentioned in SAL (#wikimedia-operations) [2023-10-26T14:52:18Z] <lucaswerkmeister-wmde@deploy2002> Finished scap: Backport for [[gerrit:968776|CX3 Build 0.2.0+20231026 ( T348563 T308836 )]] (duration: 14m 01s)
QA Scenario 1:
The "usecase" parameter set to "unified-dashboard" is used to fetch the draft and the published translations. Separate requests are used, and the "type" parameter defines which kind of translations should be fetched (draft or published)
QA Scenario 2:
The "usecase" parameter set to "translation-corpora-units" is used to fetch the translation corpora units during draft translation restoration in mobile editor.
QA Scenario 5-6:
The "usecase" parameter set to "desktop-editor-draft" is used to fetch the draft translation info, as well as the translation corpora units, during draft translation restoration in desktop editor. The previous 2 separate requests are now combined into a single one, as demonstrated in the following screenshots.
Scenarios 3 and 4 have not been changed, and continue to work with the previous implementation. This is because we are soon moving to the unified dashboard, and it didn't make sense to spend time on refactoring code that will soon be obsolete. Based on above QA, this task can be considered as done.