mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-22 08:26:16 -04:00
prepare to async: stricter checks
This change is in preparation of the future async refactoring by Ray. It tries to extract as many changes in boolean conditions as possible, in order to make more evident identifying eventual logic bugs in the future work. This proved already useful in at least one case. BEWARE: this commit exposes an incoherency in the DB API, in which, depending on the driver used, some functions can return null or undefined. This condition will be externally fixed by the final commit in this series ("db/DB.js: prevent DB layer from returning undefined"). Until that commit, the code base may have some bugs.
This commit is contained in:
parent
e841798314
commit
11453d544c
7 changed files with 36 additions and 36 deletions
|
@ -188,7 +188,7 @@ exports.handle = function(apiVersion, functionName, fields, req, res)
|
|||
// check the api key!
|
||||
fields["apikey"] = fields["apikey"] || fields["api_key"];
|
||||
|
||||
if (fields["apikey"] != apikey.trim()) {
|
||||
if (fields["apikey"] !== apikey.trim()) {
|
||||
res.statusCode = 401;
|
||||
res.send({code: 4, message: "no or wrong API Key", data: null});
|
||||
return;
|
||||
|
|
|
@ -95,7 +95,7 @@ exports.setSocketIO = function(_socket) {
|
|||
var checkAccessCallback = function(err, statusObject) {
|
||||
ERR(err);
|
||||
|
||||
if (statusObject.accessStatus == "grant") {
|
||||
if (statusObject.accessStatus === "grant") {
|
||||
// access was granted, mark the client as authorized and handle the message
|
||||
clientAuthorized = true;
|
||||
handleMessage(client, message);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue