fix: email locale in invite accepted email (#7124)

This commit is contained in:
Dhruwang Jariwala
2026-01-19 19:02:01 +05:30
committed by GitHub
parent 047750967c
commit 2b526a87ca
19 changed files with 248 additions and 44 deletions

View File

@@ -33,7 +33,7 @@ export const resetPasswordAction = actionClient.schema(ZResetPasswordAction).act
ctx.auditLoggingCtx.oldObject = oldObject;
ctx.auditLoggingCtx.newObject = updatedUser;
await sendPasswordResetNotifyEmail(updatedUser);
await sendPasswordResetNotifyEmail({ email: updatedUser.email, locale: updatedUser.locale });
return { success: true };
}
)

View File

@@ -69,6 +69,7 @@ describe("invite", () => {
creator: {
name: "Test User",
email: "test@example.com",
locale: "en-US",
},
};
@@ -89,6 +90,7 @@ describe("invite", () => {
select: {
name: true,
email: true,
locale: true,
},
},
},

View File

@@ -46,6 +46,7 @@ export const getInvite = reactCache(async (inviteId: string): Promise<InviteWith
select: {
name: true,
email: true,
locale: true,
},
},
},

View File

@@ -102,7 +102,12 @@ export const InvitePage = async (props: InvitePageProps) => {
);
}
await deleteInvite(inviteId);
await sendInviteAcceptedEmail(invite.creator.name ?? "", user?.name ?? "", invite.creator.email);
await sendInviteAcceptedEmail(
invite.creator.name ?? "",
user?.name ?? "",
invite.creator.email,
invite.creator.locale
);
await updateUser(session.user.id, {
notificationSettings: {
...user.notificationSettings,

View File

@@ -1,10 +1,12 @@
import { Invite } from "@prisma/client";
import { TUserLocale } from "@formbricks/types/user";
export interface InviteWithCreator
extends Pick<Invite, "id" | "expiresAt" | "organizationId" | "role" | "teamIds"> {
creator: {
name: string | null;
email: string;
locale: TUserLocale;
};
}

View File

@@ -127,7 +127,12 @@ async function handleInviteAcceptance(
},
});
await sendInviteAcceptedEmail(invite.creator.name ?? "", user.name, invite.creator.email);
await sendInviteAcceptedEmail(
invite.creator.name ?? "",
user.name,
invite.creator.email,
invite.creator.locale
);
await deleteInvite(invite.id);
}
@@ -168,7 +173,7 @@ async function handlePostUserCreation(
}
if (!emailVerificationDisabled) {
await sendVerificationEmail(user);
await sendVerificationEmail({ id: user.id, email: user.email, locale: user.locale });
}
}

View File

@@ -48,8 +48,7 @@ describe("resendVerificationEmailAction", () => {
const mockUser = {
id: "user123",
email: "test@example.com",
emailVerified: null, // Not verified
name: "Test User",
locale: "en-US",
};
const mockVerifiedUser = {

View File

@@ -32,7 +32,7 @@ export const resendVerificationEmailAction = actionClient.schema(ZResendVerifica
};
}
ctx.auditLoggingCtx.userId = user.id;
await sendVerificationEmail(user);
await sendVerificationEmail({ id: user.id, email: user.email, locale: user.locale });
return {
success: true,
};