Skip to content

Commit

Permalink
fix(outlook-api): Detect if message is from Inbox when processing mes…
Browse files Browse the repository at this point in the history
…sageNew webhook
  • Loading branch information
andris9 committed Oct 26, 2024
1 parent bb9baa1 commit 2a72aa0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions workers/webhooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 || {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 2a72aa0

Please sign in to comment.