Updating a card without `done` clears its done state
维护者通常 1 天内回复
评估
调研方向
从 CardService::update() 约第 323-327 行开始,那里的 else 分支会清除 done 状态;然后将其与 CardOcsController::update() 约第 124 行的 OptionalNullableValue 检查,以及那里的 else 分支进行比较。在修改任何内容之前,请阅读提交 cf4d6268a 和 issue #534,确认 else 分支存在的原因。完成的标准是:不带 done 的 PUT 保留卡片的 done 状态,而显式的 "done": null 仍会清除它,并且现有的卡片更新测试全部通过。
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- JavaScript
- 星标
- 1.4k
- 派生
- 380
- 平均合并
- 1 天 17 小时
- 30 天内合并 PR
- 72
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
nextcloud/deck 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
2 small URL Bugs未关闭1. to develop bug
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
Updating a card on an incoming federated board without `done` returns 500可能已有人在做 @AlirezaAghaee1996 于 5 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
Deck treats unset files_sharing server-to-server keys as disabled可能已有人在做 @whoalin1 于 5 天前认领。 未关闭0. Needs triage bug
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
vecture-be/belgium-data-desk#181 ·
维护者通常 1 天内回复
-
enhancement frontend reconciliation UX
难度 2/5 1-3 小时 新手友好度 82/100
humlab-sead/sead_shape_shifter#882 ·
维护者通常 1 天内回复
-
good first issue help wanted
难度 2/5 1-3 小时 新手友好度 88/100
erkamyaman/rust-anything#1381 ·
维护者通常 1 天内回复
-
a11y accessibility area: i18n area: pages area: sites bug i18n priority: P2 seo tech: javascript tests
难度 2/5 1-3 小时 新手友好度 83/100
维护者通常 1 天内回复