1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Update file, http and email nodes to only show deprecation warning

if msg property is a real overide  to node property ( !== ).

Fix for comment by @drJeckyll  to Issue #399
This commit is contained in:
Dave C-J 2014-12-01 22:58:25 +00:00
parent e9b1e287ba
commit 5f74a1d237
3 changed files with 8 additions and 7 deletions

View File

@ -68,7 +68,7 @@ module.exports = function(RED) {
} }
}; };
var corsHandler = function(req,res,next) { next(); }; var corsHandler = function(req,res,next) { next(); }
if (RED.settings.httpNodeCors) { if (RED.settings.httpNodeCors) {
corsHandler = cors(RED.settings.httpNodeCors); corsHandler = cors(RED.settings.httpNodeCors);
@ -144,6 +144,7 @@ module.exports = function(RED) {
} }
RED.nodes.registerType("http response",HTTPOut); RED.nodes.registerType("http response",HTTPOut);
function HTTPRequest(n) { function HTTPRequest(n) {
RED.nodes.createNode(this,n); RED.nodes.createNode(this,n);
var nodeUrl = n.url; var nodeUrl = n.url;
@ -154,7 +155,7 @@ module.exports = function(RED) {
node.status({fill:"blue",shape:"dot",text:"requesting"}); node.status({fill:"blue",shape:"dot",text:"requesting"});
var url; var url;
if (msg.url) { if (msg.url) {
if (n.url) { if (n.url && (n.url !== msg.url)) {
node.warn("Deprecated: msg properties should not override set node properties. See bit.ly/nr-override-msg-props"); node.warn("Deprecated: msg properties should not override set node properties. See bit.ly/nr-override-msg-props");
} }
url = msg.url; url = msg.url;
@ -170,7 +171,7 @@ module.exports = function(RED) {
var method; var method;
if (msg.method) { if (msg.method) {
if (n.method) { if (n.method && (n.method !== msg.method)) {
node.warn("Deprecated: msg properties should not override set node properties. See bit.ly/nr-override-msg-props"); node.warn("Deprecated: msg properties should not override set node properties. See bit.ly/nr-override-msg-props");
} }
method = msg.method.toUpperCase(); method = msg.method.toUpperCase();
@ -251,4 +252,4 @@ module.exports = function(RED) {
password: {type: "password"} password: {type: "password"}
} }
}); });
}; }

View File

@ -72,7 +72,7 @@ module.exports = function(RED) {
if (smtpTransport) { if (smtpTransport) {
node.status({fill:"blue",shape:"dot",text:"sending"}); node.status({fill:"blue",shape:"dot",text:"sending"});
var payload = RED.util.ensureString(msg.payload); var payload = RED.util.ensureString(msg.payload);
if (msg.to && node.name) { if (msg.to && node.name && (msg.to !== node.name)) {
node.warn("Deprecated: msg properties should not override set node properties. See bit.ly/nr-override-msg-props"); node.warn("Deprecated: msg properties should not override set node properties. See bit.ly/nr-override-msg-props");
} }
smtpTransport.sendMail({ smtpTransport.sendMail({

View File

@ -27,7 +27,7 @@ module.exports = function(RED) {
this.on("input",function(msg) { this.on("input",function(msg) {
var filename; var filename;
if (msg.filename) { if (msg.filename) {
if (n.filename) { if (n.filename && (n.filename !== msg.filename)) {
node.warn("Deprecated: msg properties should not override set node properties. See bit.ly/nr-override-msg-props"); node.warn("Deprecated: msg properties should not override set node properties. See bit.ly/nr-override-msg-props");
} }
filename = msg.filename; filename = msg.filename;
@ -89,7 +89,7 @@ module.exports = function(RED) {
this.on("input",function(msg) { this.on("input",function(msg) {
var filename; var filename;
if (msg.filename) { if (msg.filename) {
if (n.filename) { if (n.filename && (n.filename !== msg.filename)) {
node.warn("Deprecated: msg properties should not override set node properties. See bit.ly/nr-override-msg-props"); node.warn("Deprecated: msg properties should not override set node properties. See bit.ly/nr-override-msg-props");
} }
filename = msg.filename; filename = msg.filename;