From fa51c8fb364d04395b7870a4a15505415c912d5a Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Wed, 21 Dec 2016 17:17:35 +0000 Subject: [PATCH] Fix email read flag scoping issue to close #265 --- CONTRIBUTING.md | 1 - social/email/61-email.js | 6 +++--- social/email/package.json | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9ff88e35..006f956a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -52,7 +52,6 @@ to do so automatically. Please ensure you follow the coding standards used through-out the existing code base. Some basic rules include: - - all files must have the Apache license in the header. - indent with 4-spaces, no tabs. No arguments. - opening brace on same line as `if`/`for`/`function` and so on, closing brace on its own line. diff --git a/social/email/61-email.js b/social/email/61-email.js index b0bd91b5..1373cf4e 100644 --- a/social/email/61-email.js +++ b/social/email/61-email.js @@ -319,7 +319,7 @@ module.exports = function(RED) { } var marks = false; - if (this.disposition === "Read") { marks = true; } + if (node.disposition === "Read") { marks = true; } // We have the search results that contain the list of unseen messages and can now fetch those messages. var fetch = imap.fetch(results, { bodies: '', @@ -351,8 +351,8 @@ module.exports = function(RED) { // When we have fetched all the messages, we don't need the imap connection any more. fetch.on('end', function() { + node.status({}); var cleanup = function() { - node.status({}); imap.end(); }; if (this.disposition === "Delete") { @@ -370,8 +370,8 @@ module.exports = function(RED) { }); // End of imap->search }); // End of imap->openInbox }); // End of imap->ready - imap.connect(); node.status({fill:"grey",shape:"dot",text:"node-red:common.status.connecting"}); + imap.connect(); } // End of checkIMAP diff --git a/social/email/package.json b/social/email/package.json index 47ab762a..cd9a4758 100644 --- a/social/email/package.json +++ b/social/email/package.json @@ -1,6 +1,6 @@ { "name": "node-red-node-email", - "version": "0.1.14", + "version": "0.1.15", "description": "Node-RED nodes to send and receive simple emails", "dependencies": { "nodemailer": "^1.11.0",