From 432e987ad660c3fbb2d7745031e9c70c883b535d Mon Sep 17 00:00:00 2001 From: baozhoutao Date: Sun, 10 Mar 2024 15:44:18 +0800 Subject: [PATCH] Update upsetSpaceUser.js --- services/standard-space/src/methods/upsetSpaceUser.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/standard-space/src/methods/upsetSpaceUser.js b/services/standard-space/src/methods/upsetSpaceUser.js index f302fbe208..e3071259e6 100644 --- a/services/standard-space/src/methods/upsetSpaceUser.js +++ b/services/standard-space/src/methods/upsetSpaceUser.js @@ -39,7 +39,10 @@ module.exports = { modified: new Date() }, spaceUser)) }else{ - const sUser2 = await spaceUsersObj.find({filters: ['username', '=', spaceUser.username]}); + let sUser2 = [] + if(spaceUser.username){ + sUser2 = await spaceUsersObj.find({filters: ['username', '=', spaceUser.username]}); + } if(sUser2.length > 0){ await spaceUsersObj.directUpdate(sUser2[0]._id, Object.assign({ organization,