Improve owner transfer process and member sorting
Extended the account ownership transfer tests and implemented several updates. This includes transferring the ownership only to an existing account member, sorting team members based on role hierarchy and whether a member is the primary owner. In the permissions check, prevented non-members from creating invitations and enhanced the styling of role badges depending on if they are custom or not.
This commit is contained in:
@@ -125,6 +125,7 @@ export class AccountMembersService {
|
||||
|
||||
async transferOwnership(
|
||||
params: z.infer<typeof TransferOwnershipConfirmationSchema>,
|
||||
adminClient: SupabaseClient<Database>,
|
||||
) {
|
||||
const logger = await getLogger();
|
||||
|
||||
@@ -135,7 +136,7 @@ export class AccountMembersService {
|
||||
|
||||
logger.info(ctx, `Transferring ownership of account...`);
|
||||
|
||||
const { data, error } = await this.client.rpc(
|
||||
const { data, error } = await adminClient.rpc(
|
||||
'transfer_team_account_ownership',
|
||||
{
|
||||
target_account_id: params.accountId,
|
||||
|
||||
Reference in New Issue
Block a user