Follow-up to PR #6926. Clearing a value is an edit recorded in History,
not a deletion, so Admin Panel / Problems / Delete has no part in it and
the old value stays restorable. collection2's default clean removes ''
from $set and then throws "your modifier is now empty", so:
- History's redo and Restore of a cleared title or description threw,
while undo worked. applyFieldContent now writes the recorded value back
exactly (removeEmptyStrings and trimStrings off).
- The card details title and description clear, and the board
description clear, pass removeEmptyStrings: false.
- REST card PUT always passes removeEmptyStrings: false for title and
description: a title of only spaces was trimmed to '' and then removed,
a 500, and the #6877 description clear had no option at all.
tests/emptyStringClearWrites.test.cjs replays undo/redo/Restore through a
collection2-like clean and pins the options at every write;
tests/playwright/specs/card-clear-undo-redo.e2e.js clears in the card
details and over REST, then undoes and redoes.
Thanks to AhmedLukman and xet7 !
Keep accepting the isOverTime request parameter and write its validated value to the isOvertime schema field used by card readers and the UI.
Correct the handler regression and cover JSON/form edits, persistence, API reads, reactive display, reloads and rejected requests.
#6877 made the card PUT write `sort` whenever it is present, so 0 works -
and so would null, '' or 'abc', written as the card's position. The same
handler read `isOverTime` and `description` by truthiness, so false could
not be set and an empty description could not clear the old one.
parseCardScalarFields() in server/lib/restCardHelpers.js now decides all
three by presence and checks them before the first write: sort must be a
finite number (a form-encoded '0' becomes 0), isOverTime true/false or
'true'/'false', description a string (null clears it). Anything else is a
400 and the card is left as it was, rather than half of the edit applied.
tests/restCardSort.test.cjs drives the handler for the accepted values,
refuses the invalid ones with no writes, and fails if any of the three is
read by truthiness again.
Thanks to AhmedLukman and xet7 !
Check whether sort is supplied so JSON updates can persist a zero position. Keep the existing scoped update and history handling, and add handler and browser regressions for ordering, persistence, omitted values and rejected requests.