Page MenuHomePhabricator

Prevent removing last form representation in UI
Closed, ResolvedPublic

Description

As an editor, I want to edit forms without getting API errors. If a form must have at least one representation, then the UI should not let me try to save a form with no representations and then show me an API error.

Problem/Example:
Currently, the UI lets you remove any form representation, including the last one.


When you save the form, you get an API error.

Screenshots/mockups:
Instead, the “remove” button should be grayed out on the last representation:

BDD
GIVEN I am on a lexeme page
AND I edit a form with one representation
WHEN I try to remove the representation
THEN the “remove” button is grayed out.

GIVEN I am on a lexeme page
AND I edit a form with one representation
WHEN I add a second representation
THEN I can remove either of the two existing representations.

Acceptance criteria:

  • It is no longer possible to remove the last representation.
  • When there is more than one representation, any one of them can be removed, including the first or last one (no single representation is “pinned” to be the one that must remain).

Open questions:
@Lydia_Pintscher does this sound okay? It’s slightly different from the behavior specified for sense glosses in T198035: Sense should have at least one Gloss, where you wrote that the save button should be grayed out.

Event Timeline

Restricted Application added a project: Wikidata. · View Herald TranscriptJul 16 2018, 2:27 PM
Lucas_Werkmeister_WMDE renamed this task from Wikidata Ticket Template to Prevent removing last form representation in UI.Jul 16 2018, 2:27 PM

Change 446013 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/WikibaseLexeme@master] Prevent empty form representations in front-end

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

Change 446013 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] Prevent empty form representations in front-end

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

This is now live on beta and can be tested e. g. on L1. @Lydia_Pintscher do you want to review it before we close the task?

I quickly checked and I think I am missing something. Let's quickly look at it together tomorrow?

Lucas_Werkmeister_WMDE closed this task as Resolved.Aug 7 2018, 10:21 AM
Lucas_Werkmeister_WMDE claimed this task.