Page MenuHomePhabricator

[Bug] Adding a second Gloss in the same language overwrites existing Gloss
Closed, ResolvedPublic

Description

Problem:
It is possible to add a second Gloss in the same language to a Sense. The edit then overwrites the existing Gloss. It should not be possible to add a second Gloss for the same language.

Screenshot:
How this looks for the spelling variant check on Lemma and Representation:

Screenshot_20180902_144354.png (484×1 px, 45 KB)

Screenshot_20180902_144327.png (643×1 px, 57 KB)

BDD
GIVEN a Sense has a Gloss in language A
AND I try to add another Gloss in language A
THEN the language field is marked in red
AND a a message appears saying "It is not possible to enter multiple Glosses with the same language."
AND the "publish" link is grayed out

Acceptance criteria:

  • I can not store a second Gloss for the same language on the same Sense

Notes:

  • Also check this for the API.
  • The desired behavior is already in place for spelling variant of Lemma and Representation.

Event Timeline

This is a little bit more complex than it looks because the frontend sends exactly the same request when someone adds a gloss with duplicated language (invalid) or just changes the gloss (valid). So handling it in backend seems tricky or not even needed. We need to do the check in frontend anyway.

Change 455863 had a related patch set uploaded (by Ladsgroup; owner: Amir Sarabadani):
[mediawiki/extensions/WikibaseLexeme@master] [WIP] Throw error when two glosses in a sense have the same language

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

This sounds a lot like T195372 - are we making sure that the resulting user experience is comparable?

Excellent point. Will adapt the task description. Also removing story points as it will probably need to be reestimated.

Change 457919 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/WikibaseLexeme@master] Check for duplicate gloss language codes

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

Change 455863 abandoned by Ladsgroup:
[WIP] Throw error when two glosses in a sense have the same language

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

Change 457919 abandoned by Lucas Werkmeister (WMDE):
Check for duplicate gloss language codes

Reason:
This clearly goes against whatever we’re currently doing for similar cases elsewhere, whether I like it or not.

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

@Lydia_Pintscher & WMDE-Design how does this look?

image.png (318×906 px, 21 KB)

The Forms version looks like this:

image.png (300×966 px, 20 KB)

I could also switch the order of the add button and the error:

image.png (350×898 px, 23 KB)

Change 459564 had a related patch set uploaded (by Addshore; owner: Addshore):
[mediawiki/extensions/WikibaseLexeme@master] WIP Senses: Prevent redundant gloss languages

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

Change 459569 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/WikibaseLexeme@master] WIP: Warn about sense glosses with duplicate language codes

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

Change 459564 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] Senses: Prevent redundant gloss languages

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

Change 459569 abandoned by Lucas Werkmeister (WMDE):
WIP: Warn about sense glosses with duplicate language codes

Reason:
Superseded by Ifa48f76dff.

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