看板范围默认从「只看我的」改为「团队全部」,同事移交或推进的工单不用 手动切开关就能看见。同事的卡片按 Gitea 归属(assignee 优先,无 assignee 退回创建者)判定为只读:禁止拖列、开会话、实施、合并分支、删 worktree、 删改工单,卡片右上角贴归属人头像,详情面板属性表整体消毒并显示只读徽章。 看 PR 改动、勾已查看、生成文件摘要属于本机审查动作,照常放行。 扩展侧在消息分发前统一拦截需要归属人身份的消息,兜住前端快照过期或工单 刚被重新指派的竞态;webhook 单卡上板时同步归属,避免增量卡漏进门禁。 头像由扩展侧带 token 抓回转 data URI 下发,绕开 webview CSP 对外链图片 的限制,按 URL 进程内缓存。 Claude-Session: https://claude.ai/code/session_01KSgcQwf1mWrb8qeTKFvJbV
36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { isIssueMine, issueOwnerLogin } from './issueOwnership'
|
|
|
|
describe('isIssueMine', () => {
|
|
it('assignee 含我 → 可写', () => {
|
|
expect(isIssueMine({ poster: 'chehongwei', assignees: ['cruldra'] }, 'cruldra')).toBe(true)
|
|
})
|
|
|
|
it('assignee 是别人 → 只读,创建者是我也不算', () => {
|
|
expect(isIssueMine({ poster: 'cruldra', assignees: ['chehongwei'] }, 'cruldra')).toBe(false)
|
|
})
|
|
|
|
it('无 assignee 时按创建者判定', () => {
|
|
expect(isIssueMine({ poster: 'chehongwei' }, 'cruldra')).toBe(false)
|
|
expect(isIssueMine({ poster: 'cruldra' }, 'cruldra')).toBe(true)
|
|
})
|
|
|
|
it('身份未知 → 一律可写', () => {
|
|
expect(isIssueMine({ poster: 'chehongwei' }, undefined)).toBe(true)
|
|
})
|
|
|
|
it('youtrack 等无归属字段的工单 → 可写', () => {
|
|
expect(isIssueMine({}, 'cruldra')).toBe(true)
|
|
})
|
|
})
|
|
|
|
describe('issueOwnerLogin', () => {
|
|
it('assignee 优先于创建者', () => {
|
|
expect(issueOwnerLogin({ poster: 'cruldra', assignees: ['chehongwei'] })).toBe('chehongwei')
|
|
})
|
|
|
|
it('无 assignee 时回退创建者', () => {
|
|
expect(issueOwnerLogin({ poster: 'cruldra' })).toBe('cruldra')
|
|
})
|
|
})
|