feat(server): team mail sender (#9104)

fix AF-1914
This commit is contained in:
darkskygit
2024-12-12 07:33:31 +00:00
parent 350696c861
commit 69e5997608
19 changed files with 416 additions and 208 deletions

View File

@@ -88,7 +88,7 @@ export const CloudWorkspaceMembersPanel = ({
const onGenerateInviteLink = useCallback(
async (expireTime: WorkspaceInviteLinkExpireTime) => {
const link =
const { link } =
await permissionService.permission.generateInviteLink(expireTime);
return link;
},

View File

@@ -16,10 +16,7 @@ export class WorkspacePermissionService extends Service {
}
async leaveWorkspace() {
await this.store.leaveWorkspace(
this.workspaceService.workspace.id,
this.workspaceService.workspace.name$.value ?? ''
);
await this.store.leaveWorkspace(this.workspaceService.workspace.id);
this.workspacesService.list.revalidate();
}
}

View File

@@ -180,7 +180,7 @@ export class WorkspacePermissionStore extends Store {
/**
* @param workspaceName for send email
*/
async leaveWorkspace(workspaceId: string, workspaceName: string) {
async leaveWorkspace(workspaceId: string) {
if (!this.workspaceServerService.server) {
throw new Error('No Server');
}
@@ -188,7 +188,6 @@ export class WorkspacePermissionStore extends Store {
query: leaveWorkspaceMutation,
variables: {
workspaceId,
workspaceName,
},
});
}

View File

@@ -840,12 +840,8 @@ export const leaveWorkspaceMutation = {
definitionName: 'leaveWorkspace',
containsFile: false,
query: `
mutation leaveWorkspace($workspaceId: String!, $workspaceName: String!, $sendLeaveMail: Boolean) {
leaveWorkspace(
workspaceId: $workspaceId
workspaceName: $workspaceName
sendLeaveMail: $sendLeaveMail
)
mutation leaveWorkspace($workspaceId: String!, $sendLeaveMail: Boolean) {
leaveWorkspace(workspaceId: $workspaceId, sendLeaveMail: $sendLeaveMail)
}`,
};
@@ -1442,7 +1438,10 @@ export const createInviteLinkMutation = {
containsFile: false,
query: `
mutation createInviteLink($workspaceId: String!, $expireTime: WorkspaceInviteLinkExpireTime!) {
createInviteLink(workspaceId: $workspaceId, expireTime: $expireTime)
createInviteLink(workspaceId: $workspaceId, expireTime: $expireTime) {
link
expireTime
}
}`,
};

View File

@@ -1,11 +1,3 @@
mutation leaveWorkspace(
$workspaceId: String!
$workspaceName: String!
$sendLeaveMail: Boolean
) {
leaveWorkspace(
workspaceId: $workspaceId
workspaceName: $workspaceName
sendLeaveMail: $sendLeaveMail
)
mutation leaveWorkspace($workspaceId: String!, $sendLeaveMail: Boolean) {
leaveWorkspace(workspaceId: $workspaceId, sendLeaveMail: $sendLeaveMail)
}

View File

@@ -2,5 +2,8 @@ mutation createInviteLink(
$workspaceId: String!
$expireTime: WorkspaceInviteLinkExpireTime!
) {
createInviteLink(workspaceId: $workspaceId, expireTime: $expireTime)
createInviteLink(workspaceId: $workspaceId, expireTime: $expireTime) {
link
expireTime
}
}

View File

@@ -567,7 +567,7 @@ export interface Mutation {
createCopilotSession: Scalars['String']['output'];
/** Create a stripe customer portal to manage payment methods */
createCustomerPortal: Scalars['String']['output'];
createInviteLink: Scalars['String']['output'];
createInviteLink: InviteLink;
/** Create a new user */
createUser: UserType;
/** Create a new workspace */
@@ -735,7 +735,7 @@ export interface MutationInviteBatchArgs {
export interface MutationLeaveWorkspaceArgs {
sendLeaveMail?: InputMaybe<Scalars['Boolean']['input']>;
workspaceId: Scalars['String']['input'];
workspaceName: Scalars['String']['input'];
workspaceName?: InputMaybe<Scalars['String']['input']>;
}
export interface MutationPublishPageArgs {
@@ -2163,7 +2163,6 @@ export type InvoicesQuery = {
export type LeaveWorkspaceMutationVariables = Exact<{
workspaceId: Scalars['String']['input'];
workspaceName: Scalars['String']['input'];
sendLeaveMail?: InputMaybe<Scalars['Boolean']['input']>;
}>;
@@ -2692,7 +2691,11 @@ export type CreateInviteLinkMutationVariables = Exact<{
export type CreateInviteLinkMutation = {
__typename?: 'Mutation';
createInviteLink: string;
createInviteLink: {
__typename?: 'InviteLink';
link: string;
expireTime: string;
};
};
export type RevokeInviteLinkMutationVariables = Exact<{