Updating a card without `done` clears its done state
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 62/100
Research direction
Start in CardService::update() around lines 323-327, where the else branch clears the done state, and compare it with the OptionalNullableValue check in CardOcsController::update() near line 124. Before changing anything, read commit cf4d6268a and issue #534 to confirm why the else branch exists. Done means a PUT without done keeps the card's done state, while an explicit "done": null still clears it, and existing card update tests still pass.
Written by the indexing model from the issue text.
Description
Describe the bug
CardOcsController::update() distinguishes a missing done from an explicit null with OptionalNullableValue:
https://github.com/nextcloud/deck/blob/bf65da22e13a366c70c72391beaee00ed2152810/lib/Controller/CardOcsController.php#L124
But CardService::update() clears the done state whenever it receives no value:
https://github.com/nextcloud/deck/blob/bf65da22e13a366c70c72391beaee00ed2152810/lib/Service/CardService.php#L323-L327
So an API client that updates a card's title without sending done marks the card as not done. The web UI is not affected, because it sends the whole card.
To Reproduce
- Mark a card as done.
- Call
PUT /ocs/v2.php/apps/deck/api/v1.0/cards/{cardId}with a new title and the other required fields, withoutdone. - The card's
doneis nownull.
Expected behavior
A missing done leaves the done state unchanged; an explicit "done": null clears it.
Suggested fix
Not tested; a direction based on the code and its history.
Drop the else branch in CardService::update():
if ($done !== null) {
$card->setDone($done->getValue());
}
The else branch was added in cf4d6268a (January 2024, for #534) so that REST clients could mark a card as undone in a normal update. Since then all three controllers (CardController, CardApiController and CardOcsController) wrap an explicit null in OptionalNullableValue, so "done": null still clears the state without the else branch. It would be good to confirm this against the use case in #534 before changing it.
Server details
Two instances, both Docker, MariaDB 11.8 / MySQL, PHP 8.5.13:
- Instance A: Nextcloud 35.0.3, Deck 1.19.2
- Instance B: Nextcloud 34.0.6, Deck 1.18.7
Reproduced on instance B; the code paths are unchanged on main (bf65da22e).
This report was drafted with AI assistance (Claude Code) and reproduced on the instance above.
- Dominant language
- JavaScript
- Stars
- 1.4k
- Forks
- 380
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 72
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nextcloud/deck
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
2 small URL BugsOpen1. to develop bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
nextcloud/deck#8834 · 1 comment ·
Maintainers usually reply within 1 day
-
Updating a card on an incoming federated board without `done` returns 500Possibly taken @AlirezaAghaee1996 claimed this 5 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Deck treats unset files_sharing server-to-server keys as disabledPossibly taken @whoalin1 claimed this 5 days ago. Open0. Needs triage bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
vecture-be/belgium-data-desk#181 ·
Maintainers usually reply within 1 day
-
enhancement frontend reconciliation UX
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
humlab-sead/sead_shape_shifter#882 ·
Maintainers usually reply within 1 day
-
good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
erkamyaman/rust-anything#1381 ·
Maintainers usually reply within 1 day
-
a11y accessibility area: i18n area: pages area: sites bug i18n priority: P2 seo tech: javascript tests
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
flisk-sh/chat#833 · 1 comment ·
Maintainers usually reply within 1 day