Resolved reply recipient userId from TenantUsers and enabled Beneficiary compliance exploration modal

This commit is contained in:
2026-10-26 10:02:14 +02:00
parent f56cb70b55
commit 155a379ab4
5 changed files with 355 additions and 50 deletions
@@ -46,6 +46,7 @@ import {
getContractSecureLink,
getEvidenceSecureLink,
submitActivityForApproval,
resolveUserIdByEmail,
} from '../../services/api';
import {
ApplicantData,
@@ -490,7 +491,7 @@ export function DashboardPage() {
return (user?.email || (user as any)?.profile?.email || '') || (user as any)?.email || 'Partner User';
};
const handleReplyToMessage = (notification: Notification) => {
const handleReplyToMessage = async (notification: Notification) => {
const senderEmail = getMessageSenderEmail(notification).trim().toLowerCase();
const currentUserEmail = (
(user?.email || (user as any)?.profile?.email || '') ||
@@ -510,11 +511,20 @@ export function DashboardPage() {
? notification.subject
: `Re: ${notification.subject || 'Message'}`;
// Requirement #1: Resolve sender's user ID from TenantUsers by email
let senderUserId: string | undefined = undefined;
if (senderEmail) {
senderUserId = await resolveUserIdByEmail(
senderEmail,
notification.organisationId || partnerSummary.primaryFundingOrg?.id || 1
);
}
setContactTarget({
organisation: partnerSummary.primaryFundingOrg,
projectTitle: replySubject,
recipientEmail: senderEmail,
recipientId: notification.recipient,
recipientId: senderUserId,
});
setMessageSubject(replySubject);
setMessageBody('');
@@ -1281,10 +1291,11 @@ export function DashboardPage() {
await sendMessage({
recipientEmail: targetEmail,
recipient: targetEmail,
recipientId: contactTarget.recipientId,
subject: subj,
message: markdown,
platform: NotificationPlatform.InApp,
organisationId: partnerSummary.primaryFundingOrg?.id || undefined,
organisationId: contactTarget.organisation?.id || partnerSummary.primaryFundingOrg?.id || 1,
});
showSuccessToast('Message Sent', `Your communication was delivered to ${targetEmail}.`);