fix(web): keep Inbox out of project channels
This commit is contained in:
@@ -74,6 +74,11 @@ const projectsSource = readFileSync('src/api/projects.ts', 'utf8')
|
|||||||
if (!projectsSource.includes("'/api/v1/projects'")) failures.push('project API must use /api/v1/projects')
|
if (!projectsSource.includes("'/api/v1/projects'")) failures.push('project API must use /api/v1/projects')
|
||||||
if (/['"`]\/api\/(?!v1\/)/.test(apiSource)) failures.push('src/api paths must use the /api/v1 prefix')
|
if (/['"`]\/api\/(?!v1\/)/.test(apiSource)) failures.push('src/api paths must use the /api/v1 prefix')
|
||||||
|
|
||||||
|
const mappersSource = readFileSync('src/api/mappers.tsx', 'utf8')
|
||||||
|
if (!mappersSource.includes("filter((channel) => channel.type !== 'inbox')")) {
|
||||||
|
failures.push('project channels must hide the removed Inbox message stream')
|
||||||
|
}
|
||||||
|
|
||||||
for (const match of apiSource.matchAll(/export type (\w+DTO)\s*=\s*\{([\s\S]*?)\n\}/g)) {
|
for (const match of apiSource.matchAll(/export type (\w+DTO)\s*=\s*\{([\s\S]*?)\n\}/g)) {
|
||||||
const [, name, body] = match
|
const [, name, body] = match
|
||||||
if (/^\s*\w+\s*\?\s*:/m.test(body)) failures.push(`${name} fields must be required`)
|
if (/^\s*\w+\s*\?\s*:/m.test(body)) failures.push(`${name} fields must be required`)
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ const visualCheckWorkspace = {
|
|||||||
},
|
},
|
||||||
channels: [
|
channels: [
|
||||||
{ id: 'overview', projectId, type: 'overview', title: '概况', icon: 'home', count: 0, url: '', sortOrder: 0 },
|
{ id: 'overview', projectId, type: 'overview', title: '概况', icon: 'home', count: 0, url: '', sortOrder: 0 },
|
||||||
|
{ id: 'inbox', projectId, type: 'inbox', title: 'Inbox 消息流', icon: 'email', count: 2, url: '', sortOrder: 1 },
|
||||||
{ id: 'tasks', projectId, type: 'tasks', title: '工作计划', icon: 'list', count: 0, url: '', sortOrder: 1 },
|
{ id: 'tasks', projectId, type: 'tasks', title: '工作计划', icon: 'list', count: 0, url: '', sortOrder: 1 },
|
||||||
{ id: 'ai', projectId, type: 'ai_sessions', title: 'AI 助手', icon: 'robot', count: 0, url: '', sortOrder: 2 },
|
{ id: 'ai', projectId, type: 'ai_sessions', title: 'AI 助手', icon: 'robot', count: 0, url: '', sortOrder: 2 },
|
||||||
{ id: 'notes', projectId, type: 'notes_sources', title: '笔记资料', icon: 'file', count: 0, url: '', sortOrder: 3 },
|
{ id: 'notes', projectId, type: 'notes_sources', title: '笔记资料', icon: 'file', count: 0, url: '', sortOrder: 3 },
|
||||||
@@ -156,6 +157,7 @@ const collectMetrics = async () => page.evaluate(() => {
|
|||||||
hasProjectOverview: Boolean(projectOverview),
|
hasProjectOverview: Boolean(projectOverview),
|
||||||
exploreSourceCardCount: document.querySelectorAll('.explore-source-card').length,
|
exploreSourceCardCount: document.querySelectorAll('.explore-source-card').length,
|
||||||
hasExploreReader: Boolean(document.querySelector('.explore-reader-layout')),
|
hasExploreReader: Boolean(document.querySelector('.explore-reader-layout')),
|
||||||
|
hasInboxChannel: [...document.querySelectorAll('.channel-button')].some((button) => button.textContent?.includes('Inbox')),
|
||||||
projectRailWidth: rail?.getBoundingClientRect().width,
|
projectRailWidth: rail?.getBoundingClientRect().width,
|
||||||
projectRail: rect(rail),
|
projectRail: rect(rail),
|
||||||
channelSidebar: rect(sidebar),
|
channelSidebar: rect(sidebar),
|
||||||
@@ -341,6 +343,7 @@ if (!workspaceExploreMetrics.stage || !workspaceExploreMetrics.projectRail) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!projectMetrics.hasProjectOverview) failures.push('expected first project click to show project overview page')
|
if (!projectMetrics.hasProjectOverview) failures.push('expected first project click to show project overview page')
|
||||||
|
if (projectMetrics.hasInboxChannel) failures.push('expected removed Inbox message stream to stay hidden from project channels')
|
||||||
if (projectMetrics.hasWorkspacePage) failures.push('expected project overview mode to leave workspace page')
|
if (projectMetrics.hasWorkspacePage) failures.push('expected project overview mode to leave workspace page')
|
||||||
if (!projectMetrics.projectButtonActive) failures.push('expected first project button to be active in project mode')
|
if (!projectMetrics.projectButtonActive) failures.push('expected first project button to be active in project mode')
|
||||||
if (projectMetrics.dashboardButtonActive) failures.push('expected dashboard button not to be active in project mode')
|
if (projectMetrics.dashboardButtonActive) failures.push('expected dashboard button not to be active in project mode')
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export function mapWorkspace(payload: ProjectWorkspaceDTO, index = 0): ProjectWo
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
project,
|
project,
|
||||||
channels: payload.channels.map(mapChannel),
|
channels: payload.channels.filter((channel) => channel.type !== 'inbox').map(mapChannel),
|
||||||
tags: payload.tags.map((tag) => tag.name),
|
tags: payload.tags.map((tag) => tag.name),
|
||||||
recentSessions: payload.recentSessions.map(mapAISession),
|
recentSessions: payload.recentSessions.map(mapAISession),
|
||||||
inbox: payload.inbox.map(mapInbox),
|
inbox: payload.inbox.map(mapInbox),
|
||||||
|
|||||||
Reference in New Issue
Block a user