fix: Fix user reinvites on FE and BE (#8261)
This commit is contained in:
@@ -89,7 +89,7 @@ import { defineComponent } from 'vue';
|
||||
import { mapStores } from 'pinia';
|
||||
import { EnterpriseEditionFeature, INVITE_USER_MODAL_KEY, VIEWS } from '@/constants';
|
||||
|
||||
import type { IUser, IUserListAction } from '@/Interface';
|
||||
import type { IUser, IUserListAction, InvitableRoleName } from '@/Interface';
|
||||
import { useToast } from '@/composables/useToast';
|
||||
import { useUIStore } from '@/stores/ui.store';
|
||||
import { useSettingsStore } from '@/stores/settings.store';
|
||||
@@ -207,9 +207,15 @@ export default defineComponent({
|
||||
},
|
||||
async onReinvite(userId: string) {
|
||||
const user = this.usersStore.getUserById(userId);
|
||||
if (user?.email) {
|
||||
if (user?.email && user?.globalRole) {
|
||||
if (!['admin', 'member'].includes(user.globalRole.name)) {
|
||||
throw new Error('Invalid role name on reinvite');
|
||||
}
|
||||
try {
|
||||
await this.usersStore.reinviteUser({ email: user.email });
|
||||
await this.usersStore.reinviteUser({
|
||||
email: user.email,
|
||||
role: user.globalRole.name as InvitableRoleName,
|
||||
});
|
||||
this.showToast({
|
||||
type: 'success',
|
||||
title: this.$locale.baseText('settings.users.inviteResent'),
|
||||
|
||||
Reference in New Issue
Block a user