Page MenuHomePhabricator

Remove language chip from title header when an object with no userlang label is edited to add one
Closed, ResolvedPublicBUG REPORT

Description

Description

Consider a ZObject that:

  • Has no label in the userlang,
  • But has a fallback label.

E.g. An object with an English label, and no Spanish label, while the uselang is set to Spanish (es).

The page title shows the fallback label:

Screenshot from 2024-04-03 17-27-15.png (840×424 px, 50 KB)

While editing the object in the Edit page (?action=edit&uselang=es), when we add a label in the user language, the title updates to the new value:

Screenshot from 2024-04-03 17-28-47.png (986×444 px, 52 KB)

However, the language chip is not removed.

Similarly, when removing the label in the user language, instead of reinstating the fallback title, we are setting it as "Untitled", but now it is shown with the existing language chip:

Screenshot from 2024-04-03 17-30-08.png (748×396 px, 46 KB)

We have recently fixed the update of the title when the label of the user language is updated in the edit page, but we haven't accounted for all the possible cases:

  • There is no fallback title:
    • From Untitled --> Titled
    • From Titled --> Untitled
  • There is fallback title:
    • From (lang) Fallback title --> Title
    • From Title --> (lang) Fallback title

Completion checklist

Event Timeline

Change #1053617 had a related patch set uploaded (by Daphne Smit; author: Daphne Smit):

[mediawiki/extensions/WikiLambda@master] AboutEditMetadataDialog: Remove language chip from title header when an object with no userlang label is edited to add one

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

DSmit-WMF changed the task status from Open to In Progress.Jul 11 2024, 8:21 AM
DSmit-WMF claimed this task.

There's a couple of issues with current patch:

Issue 1:

There could be more than one language chips. For example when seeing the edit page and both the object type and the object name don't have labels in my user language, I will see:

Editar (en) Type: (en) Object name

Screenshot from 2024-07-12 12-23-54.png (798×370 px, 46 KB)

And when adding an object name in my language, all chips disappear, instead of only the name one:

Screenshot from 2024-07-12 12-24-06.png (747×378 px, 42 KB)

This probably requires the HTML of the title to be altered, as currently there's no way to distinguish one chip from the other.

Issue 2:

When seeing an object with an available name in the title (in my language), and I delete it, if there's no fallback I see "Untitled": this is as expected.

E.g.:

  1. Open https://wikifunctions.beta.wmflabs.org/wiki/Z60?action=edit&uselang=en
  2. Edit About
  3. Remove label "Natural language"
  4. Click "Done"
  5. Title changes to "Edit Type: Untitled Z60"

However, when seeing an object with a fallback name in the title, and I delete that name, the title should also be updated to show "Untitled", but it's staying the same.

E.g.:

  1. Open https://wikifunctions.beta.wmflabs.org/wiki/Z60?action=edit&uselang=es
  2. Click "1 idioma"
  3. Click "English" item
  4. Remove "Natural language"
  5. Click "Hecho"
  6. Title stays as "Editar (en) Type: (en) Natural language Z60"

To have the fallback title up front we should probably retrieve it and either get it in vue or set it in a data-attr on the title in php.

I updated the Patch to cover all the use cases including tests and mocking jquery to satisfy coverage.

Change #1055952 had a related patch set uploaded (by Genoveva Galarza; author: Genoveva Galarza):

[mediawiki/extensions/WikiLambda@master] Add language-related getters

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

Change #1055952 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Add language-related getters

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

Change #1053617 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] AboutEditMetadataDialog: Dynamically update the page title header when the title is edited dynamically

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