From ba2a2f9a0a93c707bff8252717d6aed8dfaefdee Mon Sep 17 00:00:00 2001 From: Grigorii Shartsev Date: Wed, 22 Mar 2023 14:03:14 +0100 Subject: [PATCH] fix: fix wrong display-name property from provisioning getUser response - Fix: #70 - Related: https://github.com/nextcloud/server/pull/36665 Signed-off-by: Grigorii Shartsev --- src/patchers/nextcloud-auth.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/patchers/nextcloud-auth.js b/src/patchers/nextcloud-auth.js index af3e4a2c..39579e71 100644 --- a/src/patchers/nextcloud-auth.js +++ b/src/patchers/nextcloud-auth.js @@ -32,7 +32,9 @@ export { export function getCurrentUser() { return { uid: appData.userMetadata.id, - displayName: appData.userMetadata.displayname, - isAdmin: appData.userMetadata.groups.includes('admin'), // TODO: Is it true way to detect admin? + // Current user metadata had different property name for display name than userMetadata + // @see https://github.com/nextcloud/server/pull/36665 + displayName: appData.userMetadata.displayname ?? appData.userMetadata['display-name'], + isAdmin: appData.userMetadata.groups.includes('admin'), } }