From a75d1dd686c26ca71790cf165db8509d3a9f0f05 Mon Sep 17 00:00:00 2001 From: Marc-Andre Ferland Date: Sun, 23 May 2021 14:41:23 -0400 Subject: [PATCH] Zero is a valid return value currently ignored by the check. Replaced conditional with a specific check for a number. --- lib/runtime/make.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/runtime/make.js b/lib/runtime/make.js index da0cc23..c44e129 100644 --- a/lib/runtime/make.js +++ b/lib/runtime/make.js @@ -202,7 +202,7 @@ async function make (scope, userId) { else { if (userData.user.activeForeignSegment && runResult.activeForeignSegment.username == userData.user.activeForeignSegment.username && - runResult.activeForeignSegment.id) { + typeof runResult.activeForeignSegment.id === "number") { db.users.update({_id: userData.user._id}, {$merge: { activeForeignSegment: {id: runResult.activeForeignSegment.id} }}); @@ -211,7 +211,7 @@ async function make (scope, userId) { db.users.findOne({username: runResult.activeForeignSegment.username}, {defaultPublicSegment: true}) .then(user => { runResult.activeForeignSegment.user_id = user._id; - if(!runResult.activeForeignSegment.id && user.defaultPublicSegment) { + if(typeof runResult.activeForeignSegment.id !== "number" && typeof user.defaultPublicSegment === "number") { runResult.activeForeignSegment.id = user.defaultPublicSegment; } })