mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-02-01 03:12:42 +01:00
PadMessageHandler: reversed condition to make core logic evident. No behavioural changes.
This one replaces a big "if (message)" negating its truthy condition. Being lame, I erred on the safe side and wrote a super ugly statement that is guaranteed to respect the original logic. In the hope that eventual logic errors become more evident now. See: https://stackoverflow.com/questions/36661748/what-is-the-exact-negation-of-ifvariable-in-javascript#36661843
This commit is contained in:
parent
324929ca2d
commit
b60c0b122c
1 changed files with 64 additions and 53 deletions
|
@ -244,7 +244,19 @@ exports.handleMessage = function(client, message)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (message) {
|
/*
|
||||||
|
* In a previous version of this code, an "if (message)" wrapped the
|
||||||
|
* following async.series().
|
||||||
|
* This ugly "!Boolean(message)" is a lame way to exactly negate the truthy
|
||||||
|
* condition and replace it with an early return, while being sure to leave
|
||||||
|
* the original behaviour unchanged.
|
||||||
|
*
|
||||||
|
* A shallower code could maybe make more evident latent logic errors.
|
||||||
|
*/
|
||||||
|
if (!Boolean(message)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
async.series([
|
async.series([
|
||||||
handleMessageHook,
|
handleMessageHook,
|
||||||
//check permissions
|
//check permissions
|
||||||
|
@ -297,7 +309,6 @@ exports.handleMessage = function(client, message)
|
||||||
},
|
},
|
||||||
finalHandler
|
finalHandler
|
||||||
]);
|
]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue