Page MenuHomePhabricator

[MEX] M3.1.2 - form can be published (save new/edited statements)
Closed, ResolvedPublic

Description

When the edit form is filled out with valid information, clicking the publish button saves the entry

A/C

  • User can enter in the simple text input (string)
  • the publish button saves edits
  • When the user clicks publish the button becomes disabled, so the user doesn't bomb click it.
  • while we wait for the server to process the save, we remain on the dialog page
  • test are updated/created as needed

Suggested outline for how to approach this (from comment on parent T402620#11132237)

  • disable “publish” button after you click it; for now, let’s also disable the “cancel” and “X” buttons
  • move the statement data to the store, so that the StatementGroupView can show the updated data after the EditStatementGroup is done and gone
  • tie the data currently being edited to the store – separately, not just modifying the existing data directly, so that upon canceling we can throw the edited data away and still show the previous (saved) data; probably some kind of “the currently edited statement group” store
  • write a store action that makes an API request to edit the statement group with the new data, and wire that up to the “publish” button; any errors should just be logged to the console for now
  • when the API request returns, update the statement data store with the data returned by the server side (note: this is not necessarily exactly the data we sent! there might have been edit conflicts resolved server-side)
  • ask the API to format the value being edited (wbformatvalue) so we can display it afterwards
    • Wikibase desktop also does this constantly as you edit the input, and it also uses two formats (preview HTML and plain text), which I don’t think we need; we can do this either together with the wbparsevalue API call (mentioned above), or only after saving the edit
  • close the edit dialog and show the edited statement value in the statement view
  • show the “success” message sliding in from the bottom
  • add a loading spinner while the statement is saving

Tech note: this will first require sending the bare user-entered string to the wbparsevalue API to turn it into a data value which we can then save.

Notes:

  • Progress bar will be handled in T403979
  • Input validation will be handled in T404695
  • Integration of the success / error messaging after the response is received from the server will be implemented in T404696

Related Objects

Event Timeline

karapayneWMDE renamed this task from [MEX] M3 - save new statement to [MEX] M3.1.2 - .Sep 3 2025, 9:37 AM
karapayneWMDE renamed this task from [MEX] M3.1.2 - to [MEX] M3.1.2 - form can be published (save new/edited statements).
karapayneWMDE updated the task description. (Show Details)

Change #1185920 had a related patch set uploaded (by Arthur taylor; author: Arthur taylor):

[mediawiki/extensions/Wikibase@master] [WIP] Publish statement edits

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

Change #1187387 had a related patch set uploaded (by Arthur taylor; author: Arthur taylor):

[mediawiki/extensions/Wikibase@master] [DNM] test CI

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

Change #1187674 had a related patch set uploaded (by Arthur taylor; author: Arthur taylor):

[mediawiki/extensions/Wikibase@master] Refactor `setupVueTemplateRenderer` function

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

Change #1187761 had a related patch set uploaded (by Arthur taylor; author: Arthur taylor):

[mediawiki/extensions/Wikibase@master] Add pinia store helpers for wbui2025 jest specs

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

Change #1188318 had a related patch set uploaded (by Arthur taylor; author: Arthur taylor):

[mediawiki/extensions/Wikibase@master] Serialize data about new statements, remove deleted statements

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

Change #1187387 abandoned by Arthur taylor:

[mediawiki/extensions/Wikibase@master] [DNM] test CI

Reason:

CI has recovered

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

Change #1188745 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@master] Use Codex props for publish/cancel buttons

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

Change #1185920 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Publish statement edits when 'publish' button is clicked

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

Change #1188745 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Use Codex props for publish/cancel buttons

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

Change #1187674 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Refactor `setupVueTemplateRenderer` function

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

Change #1188789 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@master] VueNoScriptRendering: Also use ungrouped statements

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

Change #1188789 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] VueNoScriptRendering: Also use ungrouped statements

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

Tech note: this will first require sending the bare user-entered string to the wbparsevalue API to turn it into a data value which we can then save.

This isn’t happening yet with the currently merged changes; as a result, if you enter a value with leading or trailing whitespace, the wbeditentity API will return a modification-failed error (“String should not start or end with whitespace nor include vertical whitespace or tabs”).

Change #1189247 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@master] Use shared mw.Api() instance

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

Change #1189248 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@master] Add default parameters to shared mw.Api() instance

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

Change #1189247 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Use shared mw.Api() instance

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

Change #1189248 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Add default parameters to shared mw.Api() instance

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

Change #1187761 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Add pinia store helpers for wbui2025 jest specs

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

Change #1188318 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Serialize data about new statements, remove deleted statements

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

Change #1190229 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@master] WIP: Use wbparsevalue when editing statement

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

Tech note: this will first require sending the bare user-entered string to the wbparsevalue API to turn it into a data value which we can then save.

This isn’t happening yet with the currently merged changes; as a result, if you enter a value with leading or trailing whitespace, the wbeditentity API will return a modification-failed error (“String should not start or end with whitespace nor include vertical whitespace or tabs”).

Change #1190229 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@master] WIP: Use wbparsevalue when editing statement

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

I moved this remark to a separate task T405238, and changed the WIP patch to be attached to that instead, so I think this task can go into verification… product verification, I’m guessing.