✨ feat(vscode): 同事改工单所在列、开关工单时,本机看板实时跟着动

此前只有新建工单、改标题、改指派会实时上卡;列变化存在 state JSON 评论里,
而 issue_comment 处理只认带 spx:review 标识的审查评论,别人拖卡这边毫无反应,
issues closed/reopened 也没接。抽出 refreshIssueCard 作为统一刷卡入口:重拉
该工单、叠加本机运行态、按 mine 可见性门禁决定上卡还是撤卡,只刷 UI,不写
远端状态也不起会话,观察者机器执行同样安全。state 评论(解析出 column)与
工单开关都接到这个入口上。
This commit is contained in:
cruldra committed 2026-09-21 00:37:04 +08:00
1 parent 6603e76fe1
commit fb122b76ce
3 files changed
+105 -17

No files matched your search

+26
View File
@@ -394,3 +394,29 @@ describe('deleteLocalBranch', () => {
])
})
})
describe('hasStateColumn', () => {
it('带 column 的 state JSON → true', async () => {
const { hasStateColumn } = await import('../../src/gitea/stateJson')
expect(hasStateColumn('{"column":"done","pr":"318"}')).toBe(true)
expect(hasStateColumn(' {"column":"in-progress"} ')).toBe(true)
})
it('没有 column 的 state JSON → false', async () => {
const { hasStateColumn } = await import('../../src/gitea/stateJson')
expect(hasStateColumn('{"pr":"318","branch":"feature/x"}')).toBe(false)
})
it('普通文本、审查评论、空值 → false', async () => {
const { hasStateColumn } = await import('../../src/gitea/stateJson')
expect(hasStateColumn('<!-- spx:review=1 -->\n看着没问题')).toBe(false)
expect(hasStateColumn('拖到完成列了')).toBe(false)
expect(hasStateColumn('')).toBe(false)
expect(hasStateColumn(undefined)).toBe(false)
})
it('json 数组不算 state 评论', async () => {
const { hasStateColumn } = await import('../../src/gitea/stateJson')
expect(hasStateColumn('[{"column":"done"}]')).toBe(false)
})
})