feat: skip pending members in sendMentionEmails

This commit is contained in:
Henry
2026-02-08 22:15:26 +00:00
parent 149277ef39
commit 1f0c780763
4 changed files with 7 additions and 2 deletions

View File

@@ -167,7 +167,6 @@ export default function CardPage({ isTemplate }: { isTemplate?: boolean }) {
const { const {
modalContentType, modalContentType,
entityId, entityId,
openModal,
getModalState, getModalState,
clearModalState, clearModalState,
isOpen, isOpen,
@@ -198,6 +197,7 @@ export default function CardPage({ isTemplate }: { isTemplate?: boolean }) {
}; };
const board = card?.list.board; const board = card?.list.board;
const workspaceMembers = board?.workspace.members;
const boardId = board?.publicId; const boardId = board?.publicId;
const updateCard = api.card.update.useMutation({ const updateCard = api.card.update.useMutation({
@@ -286,6 +286,7 @@ export default function CardPage({ isTemplate }: { isTemplate?: boolean }) {
if (!cardId) return <></>; if (!cardId) return <></>;
return ( return (
<> <>
<PageHead <PageHead
@@ -387,7 +388,7 @@ export default function CardPage({ isTemplate }: { isTemplate?: boolean }) {
onBlur={ onBlur={
canEdit ? () => handleSubmit(onSubmit)() : undefined canEdit ? () => handleSubmit(onSubmit)() : undefined
} }
workspaceMembers={board?.workspace.members ?? []} workspaceMembers={workspaceMembers ?? []}
readOnly={!canEdit} readOnly={!canEdit}
/> />
</div> </div>

View File

@@ -77,6 +77,8 @@ export async function sendMentionEmails({
membersToNotify.map(async (member) => { membersToNotify.map(async (member) => {
const userId = member.user?.id; const userId = member.user?.id;
const email = member.user?.email ?? member.email; const email = member.user?.email ?? member.email;
// Skip pending members (no userId) - they can be mentioned but won't receive emails
if (!userId || !email) return; if (!userId || !email) return;
try { try {

View File

@@ -212,6 +212,7 @@ export const getByPublicId = async (
columns: { columns: {
publicId: true, publicId: true,
email: true, email: true,
status: true,
}, },
with: { with: {
user: { user: {

View File

@@ -508,6 +508,7 @@ export const getWithListAndMembersByPublicId = async (
columns: { columns: {
publicId: true, publicId: true,
email: true, email: true,
status: true,
}, },
with: { with: {
user: { user: {