return role from POST /invitations

This makes sure the role is in the user store in the frontend without
the FE needing to do manual remapping.
This commit is contained in:
Danny Martini 2024-10-22 18:17:01 +02:00
parent f98f0ead25
commit a6565d3cbf
No known key found for this signature in database
3 changed files with 9 additions and 1 deletions

View file

@ -244,7 +244,13 @@ export declare namespace UserRequest {
>; >;
export type InviteResponse = { export type InviteResponse = {
user: { id: string; email: string; inviteAcceptUrl?: string; emailSent: boolean }; user: {
id: string;
email: string;
inviteAcceptUrl?: string;
emailSent: boolean;
role: AssignableRole;
};
error?: string; error?: string;
}; };

View file

@ -130,6 +130,7 @@ export class UserService {
email, email,
inviteAcceptUrl, inviteAcceptUrl,
emailSent: false, emailSent: false,
role,
}, },
error: '', error: '',
}; };

View file

@ -246,6 +246,7 @@ describe('InvitationController', () => {
const { user } = response.body.data[0]; const { user } = response.body.data[0];
expect(user.inviteAcceptUrl).toBeDefined(); expect(user.inviteAcceptUrl).toBeDefined();
expect(user).toHaveProperty('role', 'global:member');
const inviteUrl = new URL(user.inviteAcceptUrl); const inviteUrl = new URL(user.inviteAcceptUrl);