Page MenuHomePhabricator

Function editor: Fix label-dependent data model behind the function page
Closed, ResolvedPublic

Description

tl;dr It seems that the labels blocks shown in the function page (one block per language) depend on the languages available as the persistent object labels (Z2K3), but this is not a restriction that faithfully reflects how the ZObject can be.

Steps to reproduce

Observed behavior

  • After successful save and being redirected to the view page, we can see that a Z2K3 empty label has been added for the new language

Screenshot from 2022-09-20 12-03-38.png (277×377 px, 20 KB)

  • This is incorrect, there should not be empty strings as labels.

Fix this error in the ZObject

  • Go to the edit page again, and into the fallback editor.
  • Remove the empty label and click Publish
  • Go back to the function editor page: the block for the removed label doesn't appear any more, which means that we cannot even edit the input field labels that we had added.
  • Expected behavior **
  • The zobject saved should never send empty monolingual strings
  • The zobject loaded in the function editor should show all available languages, even if they don't have a Z2K3 label

Event Timeline

Hi @gengh couple questions on this -

  1. When you say it shouldn't save empty monolingual strings - do you mean it a) shouldn't save the whole "Z11" object for that lang, or that b) it just shouldn't save a Z11K2 key with an empty value, ie it would therefore look like
{
                "Z1K1": "Z11",
                "Z11K1": "Z1004"
}

I think you probably mean a) as I'm not sure we'd ever save partial zobjects?

  1. If indeed a) and it shouldn't save the Z11 object for that lang at all, would the 'source' of languages for loading in the function editor just be if it had EITHER a label value or a name value?

Change 835694 had a related patch set uploaded (by Dani DW; author: Dani DW):

[mediawiki/extensions/WikiLambda@master] Add ZID to title on zFunction and zObject edit pages.

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

Change 836913 had a related patch set uploaded (by Dani DW; author: Dani DW):

[mediawiki/extensions/WikiLambda@master] Fix label-dependent data model behind the function page.

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

Change 837169 had a related patch set uploaded (by Dani DW; author: Dani DW):

[mediawiki/extensions/WikiLambda@master] Fix label-dependent data model behind the function page. Part A.

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

Change 837169 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Fix label-dependent data model behind the function page. Part A.

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

Change 836913 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Fix label-dependent data model behind the function page. Part B.

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