Updating a card without `done` clears its done state

未关闭 适合新手
#8,792 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@whoalin1 已经在做这个了。

开始于 2026年11月28日。

  • #8824 来自 @whoalin1 —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
62/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
php
领域
api, backend

调研方向

从 CardService::update() 约第 323-327 行开始,那里的 else 分支会清除 done 状态;然后将其与 CardOcsController::update() 约第 124 行的 OptionalNullableValue 检查,以及那里的 else 分支进行比较。在修改任何内容之前,请阅读提交 cf4d6268a 和 issue #534,确认 else 分支存在的原因。完成的标准是:不带 done 的 PUT 保留卡片的 done 状态,而显式的 "done": null 仍会清除它,并且现有的卡片更新测试全部通过。

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
JavaScript
星标
1.4k
派生
380
平均合并
1 天 17 小时
30 天内合并 PR
72

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

nextcloud/deck 的其他 Issue

查看 nextcloud/deck 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。