fix: fix team invite flow

This commit is contained in:
Ralph Khreish
2025-12-02 00:10:31 +01:00
parent 1dbf242ffd
commit 9c5061407f
4 changed files with 20 additions and 3 deletions

View File

@@ -927,6 +927,11 @@ export class ExportCommand extends Command {
case 'already_member':
console.log(chalk.gray(` ${inv.email}: Already a team member`));
break;
case 'already_invited':
console.log(
chalk.yellow(` ${inv.email}: Already invited (pending)`)
);
break;
case 'error':
case 'failed':
console.log(

View File

@@ -72,9 +72,19 @@ vi.mock('../services/session-manager.js', () => {
// Mock SupabaseAuthClient to avoid side effects
vi.mock('../../integration/clients/supabase-client.js', () => {
let instance: any = null;
return {
SupabaseAuthClient: class {
constructor() {}
static getInstance() {
if (!instance) {
instance = new (this as any)();
}
return instance;
}
static resetInstance() {
instance = null;
}
refreshSession() {
return Promise.resolve({});
}

View File

@@ -101,7 +101,7 @@ export interface GenerateBriefOptions {
*/
export interface InvitationResult {
email: string;
status: 'sent' | 'already_member' | 'error' | 'failed';
status: 'sent' | 'already_member' | 'already_invited' | 'error' | 'failed';
error?: string;
}
@@ -237,7 +237,7 @@ export interface SendTeamInvitationsResponse {
success: boolean;
invitations: Array<{
email: string;
status: 'sent' | 'already_member' | 'failed';
status: 'sent' | 'already_member' | 'already_invited' | 'failed';
}>;
}
@@ -248,7 +248,7 @@ export interface SendTeamInvitationsResult {
success: boolean;
invitations?: Array<{
email: string;
status: 'sent' | 'already_member' | 'failed';
status: 'sent' | 'already_member' | 'already_invited' | 'failed';
}>;
error?: {
code: string;

View File

@@ -493,6 +493,8 @@ async function handleParsePrdToHamster(prdPath) {
);
} else if (inv.status === 'failed') {
console.log(chalk.red(` ${inv.email}: Failed to send`));
} else if (inv.status === 'already_invited') {
console.log(chalk.gray(` ${inv.email}: Already invited`));
}
}
console.log('');