Updating a card without `done` clears its done state

Open Beginner friendly
#8,792 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@whoalin1 is already working on this.

Since Nov 28, 2026.

  • #8824 by @whoalin1 — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
62/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
php
Domain
api, backend

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

0. Needs triage bug

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

  1. Mark a card as done.
  2. Call PUT /ocs/v2.php/apps/deck/api/v1.0/cards/{cardId} with a new title and the other required fields, without done.
  3. The card's done is now null.

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

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nextcloud/deck

All issues in nextcloud/deck

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.