fix(id): replace with != null

Ref: #2356, #2374, #3130, #3693
This commit is contained in:
Samuel Reed 2017-12-05 09:49:50 -06:00
parent e22b960d4e
commit 2e0f3d15f9
No known key found for this signature in database
GPG Key ID: 011E698EE329F38B
3 changed files with 5 additions and 5 deletions

View File

@ -103,7 +103,7 @@ module.exports = function(AccessToken) {
var id = tokenIdForRequest(req, options);
if (id) {
if (id != null) {
this.findById(id, function(err, token) {
if (err) {
cb(err);

View File

@ -161,13 +161,13 @@ module.exports = function(registry) {
}
}
if (id && data) {
if (id != null && data) {
var model = new ModelCtor(data);
model.id = id;
fn(null, model);
} else if (data) {
fn(null, new ModelCtor(data));
} else if (id) {
} else if (id != null) {
var filter = {};
ModelCtor.findById(id, filter, options, function(err, model) {
if (err) {

View File

@ -1683,7 +1683,7 @@ module.exports = function(registry) {
ctx.instance, ctx.currentInstance, ctx.where, ctx.data);
}
if (id) {
if (id != null) {
ctx.Model.rectifyChange(id, reportErrorAndNext);
} else {
ctx.Model.rectifyAllChanges(reportErrorAndNext);
@ -1707,7 +1707,7 @@ module.exports = function(registry) {
debug('context instance:%j where:%j', ctx.instance, ctx.where);
}
if (id) {
if (id != null) {
ctx.Model.rectifyChange(id, reportErrorAndNext);
} else {
ctx.Model.rectifyAllChanges(reportErrorAndNext);