From 016132ecf6238ad710b60948949cfbb093f3dfd2 Mon Sep 17 00:00:00 2001 From: bosiraphael <71827178+bosiraphael@users.noreply.github.com> Date: Wed, 19 Jun 2024 16:00:39 +0200 Subject: [PATCH] Fix reconnect google account bug (#5905) Update syncStage to FULL_MESSAGE_LIST_FETCH_PENDING when reconnecting the account to trigger a full sync on the next cron iteration. --- .../common/repositories/message-channel.repository.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/twenty-server/src/modules/messaging/common/repositories/message-channel.repository.ts b/packages/twenty-server/src/modules/messaging/common/repositories/message-channel.repository.ts index a3a8c727ca..f2fd69cab8 100644 --- a/packages/twenty-server/src/modules/messaging/common/repositories/message-channel.repository.ts +++ b/packages/twenty-server/src/modules/messaging/common/repositories/message-channel.repository.ts @@ -57,7 +57,11 @@ export class MessageChannelRepository { this.workspaceDataSourceService.getSchemaName(workspaceId); await this.workspaceDataSourceService.executeRawQuery( - `UPDATE ${dataSourceSchema}."messageChannel" SET "syncStatus" = NULL, "syncCursor" = '', "syncStageStartedAt" = NULL + `UPDATE ${dataSourceSchema}."messageChannel" + SET "syncStatus" = NULL, + "syncStage" = '${MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING}', + "syncCursor" = '', + "syncStageStartedAt" = NULL WHERE "connectedAccountId" = $1`, [connectedAccountId], workspaceId,