mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 04:04:06 -08: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:
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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue