mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-22 12:19:09 +00:00
fix(Email Trigger (IMAP) Node): backport V2 mark-seen-after-processing to V1 (#4435)
backport V2 mark-seen-after-processing to V1
This commit is contained in:
committed by
GitHub
parent
3143292a68
commit
b296fb06f3
@@ -314,13 +314,13 @@ export class EmailReadImapV1 implements INodeType {
|
|||||||
if (format === 'simple' || format === 'raw') {
|
if (format === 'simple' || format === 'raw') {
|
||||||
fetchOptions = {
|
fetchOptions = {
|
||||||
bodies: ['TEXT', 'HEADER'],
|
bodies: ['TEXT', 'HEADER'],
|
||||||
markSeen: postProcessAction === 'read',
|
markSeen: false,
|
||||||
struct: true,
|
struct: true,
|
||||||
};
|
};
|
||||||
} else if (format === 'resolved') {
|
} else if (format === 'resolved') {
|
||||||
fetchOptions = {
|
fetchOptions = {
|
||||||
bodies: [''],
|
bodies: [''],
|
||||||
markSeen: postProcessAction === 'read',
|
markSeen: false,
|
||||||
struct: true,
|
struct: true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -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;
|
return newEmails;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user