Commit Graph
6 Commits
Author SHA1 Message Date
Lauri Ojansivu aacb2fd4d6 Clearing a card title or description can be undone and redone.
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 !
2026-11-18 21:39:15 +02:00
Ahmed Lukman 79a98822cb Report unmatched REST card title updates 2026-11-18 20:05:18 +03:00
Ahmed Lukman c59c751547 Allow clearing card titles through REST 2026-11-18 19:31:45 +03:00
Ahmed Lukman f74ef4c40d Fix REST card overtime persistence
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.
2026-11-06 19:04:30 +03:00
Lauri Ojansivu b895e61237 REST card update: sort is a number, isOverTime can be turned off, a description can be cleared.
#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 !
2026-11-06 16:24:31 +02:00
Ahmed Lukman b0a71ba57b Allow zero sort values in REST card updates
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.
2026-11-06 16:54:07 +03:00