From 2a72aa098340f4cbd12b08a71a858960ffb52ece Mon Sep 17 00:00:00 2001 From: Andris Reinman Date: Sat, 26 Oct 2024 19:50:11 +0300 Subject: [PATCH] fix(outlook-api): Detect if message is from Inbox when processing messageNew webhook --- workers/webhooks.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/workers/webhooks.js b/workers/webhooks.js index 42e00421..367a3d64 100644 --- a/workers/webhooks.js +++ b/workers/webhooks.js @@ -42,6 +42,7 @@ const { REDIS_PREFIX, ACCOUNT_DELETED_NOTIFY, MESSAGE_NEW_NOTIFY, FETCH_TIMEOUT const he = require('he'); const { fetch: fetchCmd, Agent } = require('undici'); + const fetchAgent = new Agent({ connect: { timeout: FETCH_TIMEOUT } }); config.queues = config.queues || { @@ -254,15 +255,18 @@ const notifyWorker = new Worker( if ( (job.data.account && job.data.path === 'INBOX') || job.data.specialUse === '\\Inbox' || + (job.data.data && job.data.data.messageSpecialUse === '\\Inbox') || (job.data.data && job.data.data.labels && job.data.data.labels.includes('\\Inbox')) ) { isInbox = true; } - const inboxNewOnly = (await settings.get('inboxNewOnly')) || false; - if (inboxNewOnly && !isInbox) { - // ignore this message - return; + if (!isInbox) { + const inboxNewOnly = (await settings.get('inboxNewOnly')) || false; + if (inboxNewOnly) { + // ignore this message + return; + } } break;