mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 23:46:14 -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
|
@ -122,7 +122,7 @@ exports.deleteGroup = function(groupID, callback)
|
|||
if (ERR(err, callback)) return;
|
||||
groups = groups? groups.groupIDs : [];
|
||||
|
||||
if (groups.indexOf(groupID) == -1) {
|
||||
if (groups.indexOf(groupID) === -1) {
|
||||
// it's not listed
|
||||
callback();
|
||||
|
||||
|
@ -198,7 +198,7 @@ exports.createGroup = function(callback)
|
|||
exports.createGroupIfNotExistsFor = function(groupMapper, callback)
|
||||
{
|
||||
// ensure mapper is optional
|
||||
if (typeof groupMapper != "string") {
|
||||
if (typeof groupMapper !== "string") {
|
||||
callback(new customError("groupMapper is not a string", "apierror"));
|
||||
return;
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ exports.createGroupPad = function(groupID, padName, text, callback)
|
|||
exports.doesGroupExist(groupID, function(err, exists) {
|
||||
if (ERR(err, callback)) return;
|
||||
|
||||
if (exists == false) {
|
||||
if (!exists) {
|
||||
// group does not exist
|
||||
callback(new customError("groupID does not exist", "apierror"));
|
||||
return;
|
||||
|
@ -303,7 +303,7 @@ exports.listPads = function(groupID, callback)
|
|||
if (ERR(err, callback)) return;
|
||||
|
||||
// ensure the group exists
|
||||
if (exists == false) {
|
||||
if (!exists) {
|
||||
callback(new customError("groupID does not exist", "apierror"));
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue