fix(Gmail Trigger Node): Early returns in case of no data (#6727)

This commit is contained in:
Michael Kret 2023-07-24 17:29:38 +03:00 committed by GitHub
parent 1f70f49ce5
commit c2511a829c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -257,8 +257,9 @@ export class GmailTrigger implements INodeType {
); );
responseData = responseData.messages; responseData = responseData.messages;
if (responseData === undefined) { if (!responseData?.length) {
responseData = []; webhookData.lastTimeChecked = endDate;
return null;
} }
const simple = this.getNodeParameter('simple') as boolean; const simple = this.getNodeParameter('simple') as boolean;
@ -312,6 +313,11 @@ export class GmailTrigger implements INodeType {
); );
} }
if (!responseData?.length) {
webhookData.lastTimeChecked = endDate;
return null;
}
const getEmailDateAsSeconds = (email: IDataObject) => { const getEmailDateAsSeconds = (email: IDataObject) => {
const { internalDate, date } = email; const { internalDate, date } = email;
return internalDate return internalDate