From 333f1203dcc3816b2f54196efdfd22d4d3808914 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20G=C3=B3is?= Date: Tue, 13 May 2025 09:41:33 +0100 Subject: [PATCH] refactor: lax newUserInviteLink user arg (#9967) Part of: https://linear.app/unleash/issue/2-3560/payg-flow-sends-2-email-one-from-bluebird-and-one-from-unleash-we-want This laxes our `user` argument in `newUserInviteLink` to just pick the id, since that's the only property we're interested in. This allows us to send `{ id }` when we don't have the full `IUserWithRootRole` available while keeping compatibility intact. --- src/lib/services/user-service.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/services/user-service.ts b/src/lib/services/user-service.ts index 62289199f6..7902ac9354 100644 --- a/src/lib/services/user-service.ts +++ b/src/lib/services/user-service.ts @@ -295,7 +295,7 @@ class UserService { } async newUserInviteLink( - user: IUserWithRootRole, + { id: userId }: Pick, auditUser: IAuditUser = SYSTEM_USER_AUDIT, ): Promise { const passwordAuthSettings = @@ -307,7 +307,7 @@ class UserService { let inviteLink = this.unleashUrl; if (!passwordAuthSettings.disabled) { const inviteUrl = await this.resetTokenService.createNewUserUrl( - user.id, + userId, auditUser.username, ); inviteLink = inviteUrl.toString();