The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
fixing a microsoft graph api error (#12154)
Guillim6ff5a5bafaf2
diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/microsoft/services/microsoft-get-messages.service.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/microsoft/services/microsoft-get-messages.service.tsindex 536e92937ea..21c4653abdf 100644--- a/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/microsoft/services/microsoft-get-messages.service.ts+++ b/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/microsoft/services/microsoft-get-messages.service.ts@@ -3,6 +3,7 @@ import { Injectable, Logger } from '@nestjs/common';import { isDefined } from 'twenty-shared/utils';import { ConnectedAccountWorkspaceEntity } from 'src/modules/connected-account/standard-objects/connected-account.workspace-entity';+import { MessageDirection } from 'src/modules/messaging/common/enums/message-direction.enum';import { computeMessageDirection } from 'src/modules/messaging/message-import-manager/drivers/gmail/utils/compute-message-direction.util';import { MicrosoftImportDriverException } from 'src/modules/messaging/message-import-manager/drivers/microsoft/exceptions/microsoft-import-driver.exception';import { MicrosoftGraphBatchResponse } from 'src/modules/messaging/message-import-manager/drivers/microsoft/services/microsoft-get-messages.interface';@@ -83,18 +84,24 @@ export class MicrosoftGetMessagesService {'from',),...formatAddressObjectAsParticipants(- // @ts-expect-error legacy noImplicitAny- response?.toRecipients?.map((recipient) => recipient.emailAddress),+ response?.toRecipients+ ?.filter(isDefined)+ // @ts-expect-error legacy noImplicitAny+ .map((recipient) => recipient.emailAddress),'to',),...formatAddressObjectAsParticipants(- // @ts-expect-error legacy noImplicitAny- response?.ccRecipients?.map((recipient) => recipient.emailAddress),+ response?.ccRecipients+ ?.filter(isDefined)+ // @ts-expect-error legacy noImplicitAny+ .map((recipient) => recipient.emailAddress),'cc',),...formatAddressObjectAsParticipants(- // @ts-expect-error legacy noImplicitAny- response?.bccRecipients?.map((recipient) => recipient.emailAddress),+ response?.bccRecipients+ ?.filter(isDefined)+ // @ts-expect-error legacy noImplicitAny+ .map((recipient) => recipient.emailAddress),'bcc',),];@@ -111,10 +118,12 @@ export class MicrosoftGetMessagesService {response.body?.contentType === 'text' ? response.body?.content : '',headerMessageId: response.internetMessageId,messageThreadExternalId: response.conversationId,- direction: computeMessageDirection(- response.from.emailAddress.address,- connectedAccount,- ),+ direction: response.from+ ? computeMessageDirection(+ response.from.emailAddress.address,+ connectedAccount,+ )+ : MessageDirection.INCOMING,participants: safeParticipantsFormat,attachments: [],};