From eaac0491221ef0dfbc50ce474e03527043c37e15 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Wed, 14 May 2025 14:52:54 +0200 Subject: [PATCH 1/4] fallback for legacy user --- backend/src/apis/humhub/syncUser.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/src/apis/humhub/syncUser.ts b/backend/src/apis/humhub/syncUser.ts index c29d6e29f..f6bdcbbb6 100644 --- a/backend/src/apis/humhub/syncUser.ts +++ b/backend/src/apis/humhub/syncUser.ts @@ -49,7 +49,11 @@ export async function syncUser( if (!isValid(postUser, user.id)) { return ExecutedHumhubAction.VALIDATION_ERROR } - const humhubUser = humhubUsers.get(postUser.account.username) + let humhubUser = humhubUsers.get(postUser.account.username) + if (!humhubUser) { + // fallback for legacy users + humhubUser = humhubUsers.get(user.gradidoID) + } const humHubClient = HumHubClient.getInstance() if (!humHubClient) { throw new LogError('Error creating humhub client') From 6c8ed4193a2ea7a2f494fd284bc47fbea2ceaeba Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Wed, 14 May 2025 15:40:21 +0200 Subject: [PATCH 2/4] set expected map index --- backend/src/graphql/resolver/util/syncHumhub.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/src/graphql/resolver/util/syncHumhub.ts b/backend/src/graphql/resolver/util/syncHumhub.ts index 5b851fa2f..88b8bce4b 100644 --- a/backend/src/graphql/resolver/util/syncHumhub.ts +++ b/backend/src/graphql/resolver/util/syncHumhub.ts @@ -6,6 +6,8 @@ import { PostUser } from '@/apis/humhub/model/PostUser' import { ExecutedHumhubAction, syncUser } from '@/apis/humhub/syncUser' import { UpdateUserInfosArgs } from '@/graphql/arg/UpdateUserInfosArgs' import { backendLogger as logger } from '@/server/logger' +import { PublishNameLogic } from '@/data/PublishName.logic' +import { PublishNameType } from '@/graphql/enum/PublishNameType' /** * Syncs the user with humhub @@ -44,7 +46,9 @@ export async function syncHumhub( } const humhubUsers = new Map() if (humhubUser) { - humhubUsers.set(humhubUser.account.username, humhubUser) + const publishNameLogic = new PublishNameLogic(user) + const username = publishNameLogic.getUserIdentifier(user.humhubPublishName as PublishNameType) + humhubUsers.set(username, humhubUser) } logger.debug('update user at humhub') const result = await syncUser(user, humhubUsers) From 8552a41461feaf00db765f87c34a8692d487fbb5 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Wed, 14 May 2025 15:45:45 +0200 Subject: [PATCH 3/4] fix lint --- backend/src/graphql/resolver/util/syncHumhub.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/graphql/resolver/util/syncHumhub.ts b/backend/src/graphql/resolver/util/syncHumhub.ts index 88b8bce4b..2716069ac 100644 --- a/backend/src/graphql/resolver/util/syncHumhub.ts +++ b/backend/src/graphql/resolver/util/syncHumhub.ts @@ -4,10 +4,10 @@ import { HumHubClient } from '@/apis/humhub/HumHubClient' import { GetUser } from '@/apis/humhub/model/GetUser' import { PostUser } from '@/apis/humhub/model/PostUser' import { ExecutedHumhubAction, syncUser } from '@/apis/humhub/syncUser' -import { UpdateUserInfosArgs } from '@/graphql/arg/UpdateUserInfosArgs' -import { backendLogger as logger } from '@/server/logger' import { PublishNameLogic } from '@/data/PublishName.logic' +import { UpdateUserInfosArgs } from '@/graphql/arg/UpdateUserInfosArgs' import { PublishNameType } from '@/graphql/enum/PublishNameType' +import { backendLogger as logger } from '@/server/logger' /** * Syncs the user with humhub From a83828b716b9f335ce966612f02d5336977fd5e1 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Wed, 14 May 2025 15:53:34 +0200 Subject: [PATCH 4/4] fix wrong tooltip --- frontend/src/locales/de.json | 2 +- frontend/src/locales/en.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index afde3e2c6..3638def48 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -413,7 +413,7 @@ "first": "Vorname", "first-tooltip": "Nur der Vornamen", "first-initial": "Vorname und Initial", - "first-initial-tooltip": "Vornamen plus die ersten beiden Anfangsbuchstabe des Nachnamens", + "first-initial-tooltip": "Vornamen plus den ersten Anfangsbuchstaben des Nachnamens", "initials": "Initialen", "initials-tooltip": "Initialen von Vor- und Nachname also jeweils die ersten zwei Buchstaben unabhängig von der Existenz des Benutzernamens", "name-full": "Vorname und Nachname", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index daeaa59a4..7cefaa2f9 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -413,7 +413,7 @@ "first": "Firstname", "first-tooltip": "the first name only", "first-initial": "First name and initial", - "first-initial-tooltip": "first name plus the first two initial letters of the last name", + "first-initial-tooltip": "first name plus the first letter of the last name", "initials": "Initials", "initials-tooltip": "Initials of first name and last name, i.e. the first two letters of each regardless of the existence of the user name", "name-full": "first name and last name",