🐛 fix(vscode): issue opened 广播按看板 scope 门禁,mine 不再凭空上别人的卡

This commit is contained in:
2026-08-19 20:41:11 +08:00
parent ea4c4e4658
commit fea7b2e604
5 changed files with 136 additions and 5 deletions
+4 -5
View File
@@ -7,6 +7,7 @@ import type {
import type { HookContext } from '../git/worktreeHooks'
import type { Issue } from '../gitea/types'
import type { IssueRef } from '../issues/stateRouter'
import type { KanbanScope } from './kanbanScope'
import type { ExtensionToWebview, WebviewToExtension } from './messages'
import { randomBytes } from 'node:crypto'
import * as fs from 'node:fs'
@@ -36,13 +37,11 @@ import * as toolbar from './handlers/toolbar'
import * as worktree from './handlers/worktree'
import * as youtrackIssues from './handlers/youtrackIssues'
import { PALETTE, resolveIssueColor, themeColorIdToIconUri } from './issueColor'
import { KANBAN_SCOPE_KEY } from './kanbanScope'
/** Resolved at runtime via getProfilesDir() — do not hardcode user paths. */
export { getDefaultProfilePath, getPrDiffSummaryProfilePath } from '../cc/profiles'
/** workspaceState key:看板范围('mine' 只看我的 / 'all' 团队全部)。 */
const SCOPE_KEY = 'superpowers.kanbanScope'
export class KanbanWebviewPanel {
static readonly viewType = 'superpowers.kanbanPanel'
@@ -368,7 +367,7 @@ export class KanbanWebviewPanel {
}
if (msg.type === 'issues/set-scope') {
// 视图偏好按工作区持久化;切换即重拉。
void this.context.workspaceState.update(SCOPE_KEY, msg.scope)
void this.context.workspaceState.update(KANBAN_SCOPE_KEY, msg.scope)
void this.loadAndPush()
return
}
@@ -880,7 +879,7 @@ export class KanbanWebviewPanel {
return
}
const scope = this.context.workspaceState.get<'mine' | 'all'>(SCOPE_KEY) ?? 'mine'
const scope = this.context.workspaceState.get<KanbanScope>(KANBAN_SCOPE_KEY) ?? 'mine'
try {
const giteaIssues = await loadIssues({ host, token, owner, repo, workspaceRoot, scope })
// YouTrack is a best-effort second source: a failure here must never