Skip to content

Commit

Permalink
fixed users list error (#3177)
Browse files Browse the repository at this point in the history
Co-authored-by: Stefano Ricci <[email protected]>
  • Loading branch information
SteRiccio and SteRiccio authored Dec 5, 2023
1 parent e7da615 commit b58e240
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions server/modules/user/manager/userManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,17 +135,19 @@ export { insertUserAccessRequest } from '../repository/userAccessRequestReposito

// ==== READ

const _attachAuthGroupsAndInvitationToUser = async ({ user, invitationsByUserUuid = {}, userGroups = [] }) => {
const _attachAuthGroupsAndInvitationToUser = async ({ user, invitationsByUserUuid = {}, userGroups = [], t }) => {
// Assoc auth groups

const _userGroups = R.isEmpty(userGroups) ? await AuthGroupRepository.fetchUserGroups(User.getUuid(user)) : userGroups
const _userGroups = R.isEmpty(userGroups)
? await AuthGroupRepository.fetchUserGroups(User.getUuid(user), t)
: userGroups
let userUpdated = User.assocAuthGroups(_userGroups)(user)

if (User.isInvited(userUpdated)) {
const userUuid = User.getUuid(userUpdated)
const invitation = invitationsByUserUuid[userUuid]
const invitationValid =
invitation || (await UserResetPasswordRepository.existsResetPasswordValidByUserUuid(userUuid))
invitation || (await UserResetPasswordRepository.existsResetPasswordValidByUserUuid(userUuid, t))
userUpdated = User.assocInvitationExpired(!invitationValid)(userUpdated)
}

Expand All @@ -163,6 +165,7 @@ const _attachAuthGroupsAndInvitationToUsers = async ({ users, invitationsByUserU
user,
invitationsByUserUuid,
userGroups: authGroups.filter((group) => group.userUuid === User.getUuid(user)),
t,
})
)
)
Expand Down

0 comments on commit b58e240

Please sign in to comment.