Skip to content

[#3114] 文档卡开关:General 里能关掉长文档卡片 #3184

Closed

Description

@Birfy

第十刀的收口单(umbrella #3114 保持 open;切片 PR 写 Fixes #<本单> + Part of #3114,不写 Fixes #3114)。

范围

General 页的「文档卡片」开关:设置里能关掉长文档卡片。关掉后长文档不再出卡、也不出现 Show message text,按既有折叠档(compact / standard / none)呈现;默认开(与今天一致);开关存进团队 state.prefs.documentCards,刷新与重启后保持。

依据

完整规格见 #3114 的第十刀评论 issuecomment-6989995361(19:44Z 那条已被它取代)。起草读 main 25d54e45,复核时 main 11702f1888e627493f038df6af4c6198fcc4bf2e;base 不写死——开工时从当时的 origin/main 起分支。

  • 18 个文件(手写 10 + 生成 8)、手写 +101/−7 ≈ 108 行,因 core/src/host/channel.js 命中 risk-rules.json L12 → T3,tip 上必须有 PASS(self-PASS 算)+绿 CI 才能入队。T3 无文件上限,不拆。
  • 契约:set-prefs 收 { documentCards: boolean | null };false 存 state.prefs.documentCards = false,true/null 删键(开 = 默认),其余四形('off'、0、['false']、{on:false})回 bot/invalid + Document cards must be on or off 且不落盘。放顶层键,不塞进 state.prefs.folding(否则切折叠档会被整体重写抹掉)。
  • 行为接点只有一处:core/src/client/message-fold.js 的 showsDocumentCard 第一句短路 if (folding?.documentCards === false) return false;识别门槛(12 行/800 字 + 2 标题/3 节)与 foldBody 的 streaming 先行顺序一行不改。
  • 红先(实测三阶段):阶段 A 只提测试 → install 5/6(expected: false / actual: undefined)、settings-readonly-pages 13/15(expected: 1 / actual: 0 + 控制计数 8)、message-fold 8/10;阶段 B 接 host+UI+读侧但不动 showsDocumentCard → 只剩 no card when the switch is off expected: 0 / actual: 1;阶段 C 短路后 10/10。
  • 只读窗口不画开关,出一行文本(On/Off),锁定 General 页仍 0 控件。
  • 多成员部署:set-prefs 在 authz.js 的 SHARED_BLOCKED,members>1 回 bot/blocked-shared 是既有行为,本刀不改 authz.js。

明确不做

历史搜索旧 part 跳转(第十一刀)、社交冻结人话(第十二刀,源头在 bot-social)、每窗口/每人各自的开关、卡片样式/标题/节数调整、文档编辑/导出/多 pane、附件当文档;折叠阈值/FoldedContent/shouldFold/previewOf 既有行为一行不改;authz.js、host 新端点、browser-pane.js/index.js/overlays.js、任何 gate 文件、ds-bot/**、topics.json 一律不碰。

验收

从仓库根、在已提交 client.js 的树上:cd core && npm run build 后 node core/scripts/build-client.mjs --check && git diff --exit-code -- core/client.js;install 6/6、settings-readonly-pages 15/15、message-fold 10/10;回归 8 套(tool-cells 19、empty-message-cell 3、earlier-message-actions 6、palette-preview 15、bot-browsers 14、client-bundle 2、i18n 3、i18n-missing-entries 17);node scripts/ds-bot-patches.mjs generate && check(末两行 ok)+ canonical(no-op),generate 之后用当时的 origin/main 重跑(0001/0007 已被 #3175/#3176 改过);npm --prefix core run arch-docs OK;TZ=UTC TMPDIR=/data/flybot-tmp npm run verify exit 0。新增行不许出现 fence/sanitiz/displayName/eval(/new Function( 等升档关键字(代码块一律叫 code block)。

Written-by: Chief

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions