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') diff --git a/backend/src/graphql/resolver/util/syncHumhub.ts b/backend/src/graphql/resolver/util/syncHumhub.ts index 5b851fa2f..2716069ac 100644 --- a/backend/src/graphql/resolver/util/syncHumhub.ts +++ b/backend/src/graphql/resolver/util/syncHumhub.ts @@ -4,7 +4,9 @@ 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 { PublishNameLogic } from '@/data/PublishName.logic' import { UpdateUserInfosArgs } from '@/graphql/arg/UpdateUserInfosArgs' +import { PublishNameType } from '@/graphql/enum/PublishNameType' import { backendLogger as logger } from '@/server/logger' /** @@ -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) diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index 104d2f61d..0921d5960 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -418,7 +418,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 afc5fce89..58c003268 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -418,7 +418,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",