From 043277e7d3cd52463bad4a496b14f96694171943 Mon Sep 17 00:00:00 2001 From: Stefano Ricci <1219739+SteRiccio@users.noreply.github.com> Date: Sun, 27 Oct 2024 14:50:47 +0100 Subject: [PATCH] fixed error accepting user access request (#3623) Co-authored-by: Stefano Ricci --- server/modules/user/service/userService.js | 5 ++++- webapp/components/survey/Surveys/SurveyOwnerColumn.js | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/server/modules/user/service/userService.js b/server/modules/user/service/userService.js index bc80d07d5d..11ec667dd1 100644 --- a/server/modules/user/service/userService.js +++ b/server/modules/user/service/userService.js @@ -223,7 +223,7 @@ export const acceptUserAccessRequest = async ({ user, serverUrl, accessRequestAc // 4) invite user to that group and send email const surveyId = Survey.getId(survey) - const { userInvited } = await UserInviteService.inviteUsers( + const { invitedUsers } = await UserInviteService.inviteUsers( { user, surveyId, @@ -233,9 +233,12 @@ export const acceptUserAccessRequest = async ({ user, serverUrl, accessRequestAc }, t ) + const userInvited = invitedUsers[0] const surveyOwnerUuid = User.getUuid(userInvited) + await SurveyManager.updateSurveyOwner({ user, surveyId, ownerUuid: surveyOwnerUuid, system: true }, t) survey = Survey.assocOwnerUuid(surveyOwnerUuid)(survey) + return { survey, userInvited } }) diff --git a/webapp/components/survey/Surveys/SurveyOwnerColumn.js b/webapp/components/survey/Surveys/SurveyOwnerColumn.js index 9e9a851c30..997ec0cbae 100644 --- a/webapp/components/survey/Surveys/SurveyOwnerColumn.js +++ b/webapp/components/survey/Surveys/SurveyOwnerColumn.js @@ -52,7 +52,7 @@ export const SurveyOwnerColumn = (props) => { canEdit={canEdit} className="owner-col" item={surveyInfo} - renderItem={({ item }) => Survey.getOwnerName(item)} + renderItem={({ item }) => Survey.getOwnerName(item) || '---'} renderItemEditing={() => } /> )