fix: 创建版本时自动将创建者加入 members

确保新创建的版本 members 中包含当前用户,
否则创建后自己就看不到这个版本了。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Script Generator
2026-06-15 14:32:32 +08:00
parent c8d2bfdd51
commit 2c1b68c46f

View File

@@ -373,7 +373,7 @@ export default function VersionsPage() {
</div>
</div>
{showModal && <NewVersionModal overview={overview} onClose={() => setShowModal(false)} onCreate={createVersion} />}
{showModal && <NewVersionModal overview={overview} onClose={() => setShowModal(false)} onCreate={createVersion} currentUserName={currentUserName} />}
</div>
);
}
@@ -547,7 +547,8 @@ type IterationType = 'major' | 'minor' | 'patch';
interface NewVersionModalProps {
overview: any[];
onClose: () => void;
onCreate: (productId: string, data: { name: string; status: VersionStatus; priority?: Priority; expectedReleaseDate?: string }) => void;
onCreate: (productId: string, data: { name: string; status: VersionStatus; priority?: Priority; expectedReleaseDate?: string; members?: any[] }) => void;
currentUserName: string;
}
function getNextVersion(existingVersions: any[], projectName: string, type: IterationType): string {
@@ -588,7 +589,7 @@ function getNextVersion(existingVersions: any[], projectName: string, type: Iter
}
}
function NewVersionModal({ overview, onClose, onCreate }: NewVersionModalProps) {
function NewVersionModal({ overview, onClose, onCreate, currentUserName }: NewVersionModalProps) {
const [productId, setProductId] = useState('');
const [projectId, setProjectId] = useState('');
const [projectName, setProjectName] = useState('');
@@ -647,6 +648,7 @@ function NewVersionModal({ overview, onClose, onCreate }: NewVersionModalProps)
status,
priority,
...(expectedReleaseDate ? { expectedReleaseDate } : {}),
members: currentUserName ? [{ role: 'product', name: currentUserName }] : [],
});
onClose();
} catch (e) {