Skip to content

Commit

Permalink
fix(Email Trigger (IMAP) Node): backport V2 mark-seen-after-processin…
Browse files Browse the repository at this point in the history
…g to V1 (#4435)

backport V2 mark-seen-after-processing to V1
  • Loading branch information
flipswitchingmonkey authored Oct 25, 2022
1 parent 3143292 commit b296fb0
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -314,13 +314,13 @@ export class EmailReadImapV1 implements INodeType {
if (format === 'simple' || format === 'raw') {
fetchOptions = {
bodies: ['TEXT', 'HEADER'],
markSeen: postProcessAction === 'read',
markSeen: false,
struct: true,
};
} else if (format === 'resolved') {
fetchOptions = {
bodies: [''],
markSeen: postProcessAction === 'read',
markSeen: false,
struct: true,
};
}
Expand Down Expand Up @@ -459,6 +459,13 @@ export class EmailReadImapV1 implements INodeType {
}
}

// only mark messages as seen once processing has finished
if (postProcessAction === 'read') {
const uidList = results.map((e) => e.attributes.uid);
if (uidList.length > 0) {
connection.addFlags(uidList, '\\SEEN');
}
}
return newEmails;
};

Expand Down

0 comments on commit b296fb0

Please sign in to comment.