Page MenuHomePhabricator

Improve handling of invalid qualifiers
Closed, ResolvedPublic

Description

User story: As a Commons user, when I'm adding or editing a qualifier, I want feedback if I enter an invalid value.

We have this: When a user adds a new coordinate location qualifier, the publish button is disabled until complete and valid data is entered. However, if a user changes an existing qualifier to an invalid value, they can hit publish and the qualifier is removed with no error message. To replicate:

  1. Add a coordinate location qualifier, publish
  2. Click edit and change latitude or longitude to something erroneous, e.g. over 180
  3. Hit publish and be confused...

I tested quantity locally (by editing the quantity to be blank) and the behavior was similar.

We want this: The qualifier is getting removed before the submit() method runs, therefore there is no error to catch and nothing is shown to the user. We either need to disable the publish button when there is invalid data (recommended) or ensure that an error message can be shown on publish.

Acceptance Criteria:

  • When an invalid value is input, the Publish button becomes disabled and an error message is shown to the user. Once the input becomes valid, the Publish button is enabled.

OR

  • When an invalid qualifier value is input, on publish, the process fails and an error message is shown to the user, and the qualifier is not removed.

During development, please test the following:

  • Test this feature while logged in AND logged out
  • Test this feature on at least one mobile browser
  • Test that this feature works on the file page AND the Add Data step on UploadWizard (if applicable, some features only exist on one or the other)

Event Timeline

AnneT created this task.Sep 16 2019, 8:47 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 16 2019, 8:47 PM
AnneT claimed this task.Jan 15 2020, 5:08 PM
AnneT moved this task from Triage to Current Work on the Structured-Data-Backlog board.
AnneT moved this task from Incoming to Doing on the Structured-Data-Backlog (Current Work) board.

Change 566316 had a related patch set uploaded (by Anne Tomasevich; owner: Anne Tomasevich):
[mediawiki/extensions/WikibaseMediaInfo@master] WIP: Handle globecoordinate errors

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

Note from backlog grooming today: we'll leave this here for now and consider removing it once the new coordinates code lands.

Geocoordinates code has landed. Does that change the fate of this ticket?

AnneT added a comment.Mar 10 2020, 2:54 PM

This unblocks the ticket; looks like invalid qualifiers are still getting removed without informing the user why it's happening. I can resume work on this today.

Change 579063 had a related patch set uploaded (by Anne Tomasevich; owner: Anne Tomasevich):
[mediawiki/extensions/WikibaseMediaInfo@master] Make an effort to disable publish/add buttons for invalid qualifiers

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

egardner claimed this task.Mar 11 2020, 9:25 PM

Change 579063 abandoned by Anne Tomasevich:
Make an effort to disable publish/add buttons for invalid qualifiers

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

Change 579074 had a related patch set uploaded (by Eric Gardner; owner: Eric Gardner):
[mediawiki/extensions/WikibaseMediaInfo@master] Improve handling of invalid qualifiers in GlobeCoordinateInputWidget

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

@Ramsey-WMF just posted a new patch for this. Here's the new behavior if the user tries to change a previously-valid qualifier to an invalid one:

If they made another change in the same panel (say they added a third qualifier), the "publish" button would become enabled. But the invalid qualifier data would not be submitted – instead, the previous valid data would be kept. We're basically saying: only change the widget's data to new valid coordinate values. The exception is if the user just deletes everything in the input field; that resets the data to null.

Change 579074 merged by jenkins-bot:
[mediawiki/extensions/WikibaseMediaInfo@master] Improve handling of invalid qualifiers in GlobeCoordinateInputWidget

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

Change 566316 abandoned by Anne Tomasevich:
WIP: Handle globecoordinate errors

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

Ramsey-WMF closed this task as Resolved.Apr 6 2020, 5:44 PM

Works as expected for coordinates on production. There might be some edge cases for quantity (regarding the valid entry of the letter 'e' for exponents) but it's an edge case I don't think we need to worry about for now.