Client: Added general logic for changing roles for rooms and types for accounts.
This commit is contained in:
parent
91b3212529
commit
31e91c3da5
@ -89,6 +89,7 @@ const InvitePanel = ({
|
||||
maxCountManagersByQuota,
|
||||
invitePaidUsersCount,
|
||||
setIsNewUserByCurrentUser,
|
||||
setInvitePaidUsersCount,
|
||||
}) => {
|
||||
const [invitePanelIsLoding, setInvitePanelIsLoading] = useState(
|
||||
roomId !== -1,
|
||||
@ -337,6 +338,7 @@ const InvitePanel = ({
|
||||
setIsNewUserByCurrentUser(true);
|
||||
}
|
||||
setIsLoading(false);
|
||||
setInvitePaidUsersCount(0);
|
||||
|
||||
onClose();
|
||||
toastr.success(t("Common:UsersInvited"));
|
||||
@ -550,6 +552,7 @@ export default inject(
|
||||
setInviteLanguage,
|
||||
invitePaidUsersCount,
|
||||
setIsNewUserByCurrentUser,
|
||||
setInvitePaidUsersCount,
|
||||
} = dialogsStore;
|
||||
|
||||
const { getFolderInfo, setRoomSecurity, getRoomSecurityInfo, folders } =
|
||||
@ -584,6 +587,7 @@ export default inject(
|
||||
maxCountManagersByQuota,
|
||||
invitePaidUsersCount,
|
||||
setIsNewUserByCurrentUser,
|
||||
setInvitePaidUsersCount,
|
||||
};
|
||||
},
|
||||
)(
|
||||
|
@ -138,17 +138,25 @@ const InviteInput = ({
|
||||
const uid = () => Math.random().toString(36).slice(-6);
|
||||
let userAccess = selectedAccess;
|
||||
|
||||
const isAccounts = roomId === -1;
|
||||
const isPaidAccess = isAccounts
|
||||
? isPaidUserAccess(userAccess)
|
||||
: isPaidUserRole(userAccess);
|
||||
|
||||
if (addresses.length > 1) {
|
||||
let isShowErrorToast = false;
|
||||
|
||||
const itemsArray = addresses.map((address) => {
|
||||
|
||||
if (roomId === -1 && isPaidUserAccess(userAccess)) {
|
||||
if (isPaidAccess) {
|
||||
if (isPaidUserLimit) {
|
||||
const freeType = EmployeeType.Guest;
|
||||
const FreeUser = isAccounts
|
||||
? EmployeeType.Guest
|
||||
: getTopFreeRole(t, roomType)?.access;
|
||||
|
||||
userAccess = freeType;
|
||||
isShowErrorToast = true;
|
||||
if (FreeUser) {
|
||||
userAccess = FreeUser;
|
||||
isShowErrorToast = true;
|
||||
}
|
||||
} else {
|
||||
setInvitePaidUsersCount();
|
||||
}
|
||||
@ -169,26 +177,21 @@ const InviteInput = ({
|
||||
return itemsArray;
|
||||
}
|
||||
|
||||
|
||||
if (roomId === -1 && isPaidUserAccess(userAccess)) {
|
||||
if (isPaidAccess) {
|
||||
if (isPaidUserLimit) {
|
||||
const freeType = EmployeeType.Guest;
|
||||
const FreeUser = isAccounts
|
||||
? EmployeeType.Guest
|
||||
: getTopFreeRole(t, roomType)?.access;
|
||||
|
||||
userAccess = freeType;
|
||||
toastr.error(<PaidQuotaLimitError />);
|
||||
if (FreeUser) {
|
||||
userAccess = FreeUser;
|
||||
toastr.error(<PaidQuotaLimitError />);
|
||||
}
|
||||
} else {
|
||||
setInvitePaidUsersCount();
|
||||
}
|
||||
}
|
||||
|
||||
if (isPaidUserLimit && roomId !== -1 && isPaidUserRole(userAccess)) {
|
||||
const freeRole = getTopFreeRole(t, roomType)?.access;
|
||||
if (freeRole) {
|
||||
userAccess = freeRole;
|
||||
toastr.error(<PaidQuotaLimitError />);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
email: addresses[0].email,
|
||||
id: uid(),
|
||||
|
Loading…
Reference in New Issue
Block a user