Updating a card without `done` clears its done state

Offen Anfängerfreundlich
#8,792 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@whoalin1 arbeitet bereits daran.

Seit 28.11.2026.

  • #8824 von @whoalin1 — offen

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
62/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
php
Bereich
api, backend

Rechercherichtung

Beginne in CardService::update() etwa bei den Zeilen 323-327, wo der else-Zweig den Done-Status zurücksetzt, und vergleiche ihn mit der OptionalNullableValue-Prüfung in CardOcsController::update() nahe Zeile 124 sowie mit dem else-Zweig dort. Lies vor jeder Änderung Commit cf4d6268a und Issue #534, um zu bestätigen, warum der else-Zweig existiert. Fertig ist, wenn ein PUT ohne done den Done-Status der Karte beibehält, ein explizites "done": null ihn aber weiterhin löscht und bestehende Tests für Kartenaktualisierungen weiterhin bestehen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.

Vorherrschende Sprache
JavaScript
Sterne
1.4k
Forks
380
Ø Merge
1 T. 17 Std.
Gemergte PRs (30 T.)
72

Entwicklungsumgebung

In Codespaces öffnen

Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus nextcloud/deck

Alle Issues in nextcloud/deck

Ähnliche Issues

Weitere Issues zu JavaScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.