From 896509252319ba7ab1365bc1d117f3eaf16f0890 Mon Sep 17 00:00:00 2001 From: Arne Gnisa Date: Fri, 22 Sep 2023 13:06:14 +0200 Subject: [PATCH 1/3] N21-1269 fix --- controllers/oauth2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/oauth2.js b/controllers/oauth2.js index aadc175442..f5354e4b4d 100644 --- a/controllers/oauth2.js +++ b/controllers/oauth2.js @@ -155,7 +155,7 @@ router.get('/username/:pseudonym', async (req, res, next) => { qs: { id: pseudonymResponse.userId }, $limit: 1, }); - if (userResponse.data?.length === 1) { + if (userResponse.data?.length > 0) { completeName = `${userResponse.data[0].firstName} ${userResponse.data[0].lastName}`; shortName = `${userResponse.data[0].firstName} ${userResponse.data[0].lastName.charAt(0)}.`; } From a078262113ab6d5dbb1ea450cc06b5f9235054f9 Mon Sep 17 00:00:00 2001 From: Arne Gnisa Date: Fri, 22 Sep 2023 13:34:11 +0200 Subject: [PATCH 2/3] N21-1269 fix 2 --- controllers/oauth2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/oauth2.js b/controllers/oauth2.js index f5354e4b4d..3e0c6c9731 100644 --- a/controllers/oauth2.js +++ b/controllers/oauth2.js @@ -155,7 +155,7 @@ router.get('/username/:pseudonym', async (req, res, next) => { qs: { id: pseudonymResponse.userId }, $limit: 1, }); - if (userResponse.data?.length > 0) { + if (userResponse.data.length) { completeName = `${userResponse.data[0].firstName} ${userResponse.data[0].lastName}`; shortName = `${userResponse.data[0].firstName} ${userResponse.data[0].lastName.charAt(0)}.`; } From 917b68491eb41bb4d58718074ed429a7db31457d Mon Sep 17 00:00:00 2001 From: Arne Gnisa Date: Fri, 22 Sep 2023 14:38:13 +0200 Subject: [PATCH 3/3] N21-1269 fix 2 --- controllers/oauth2.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/controllers/oauth2.js b/controllers/oauth2.js index 3e0c6c9731..0b47996516 100644 --- a/controllers/oauth2.js +++ b/controllers/oauth2.js @@ -149,10 +149,9 @@ router.get('/username/:pseudonym', async (req, res, next) => { if (Configuration.get('FEATURE_CTL_TOOLS_TAB_ENABLED')) { const pseudonymResponse = await api(req, { version: 'v3' }) .get(`/pseudonyms/${req.params.pseudonym}`); - const userResponse = await api(req) .get('/users', { - qs: { id: pseudonymResponse.userId }, + qs: { _id: pseudonymResponse.userId }, $limit: 1, }); if (userResponse.data.length) {