Client: Fixed the logic of the restriction when the user limit is reached.

This commit is contained in:
Tatiana Lopaeva 2024-08-19 10:02:24 +03:00
parent 6a7463b300
commit 0494768a60
4 changed files with 21 additions and 21 deletions

View File

@ -70,7 +70,7 @@ const ExternalLinks = ({
activeLink, activeLink,
isMobileView, isMobileView,
getPortalInviteLink, getPortalInviteLink,
isPaidUserLimit, isUserTariffLimit,
}) => { }) => {
const [isLinksToggling, setIsLinksToggling] = useState(false); const [isLinksToggling, setIsLinksToggling] = useState(false);
@ -279,7 +279,7 @@ const ExternalLinks = ({
containerRef={inputsRef} containerRef={inputsRef}
isOwner={isOwner} isOwner={isOwner}
isMobileView={isMobileView} isMobileView={isMobileView}
isSelectionDisabled={isPaidUserLimit} isSelectionDisabled={isUserTariffLimit}
selectionErrorText={<PaidQuotaLimitError />} selectionErrorText={<PaidQuotaLimitError />}
availableAccess={availableAccess} availableAccess={availableAccess}
/> />
@ -296,7 +296,7 @@ export default inject(
const { setInvitationLinks } = filesStore; const { setInvitationLinks } = filesStore;
const { roomId, hideSelector, defaultAccess } = invitePanelOptions; const { roomId, hideSelector, defaultAccess } = invitePanelOptions;
const { getPortalInviteLink } = peopleStore.inviteLinksStore; const { getPortalInviteLink } = peopleStore.inviteLinksStore;
const { isPaidUserLimit } = currentQuotaStore; const { isUserTariffLimit } = currentQuotaStore;
return { return {
setInvitationLinks, setInvitationLinks,
@ -305,7 +305,7 @@ export default inject(
defaultAccess, defaultAccess,
isOwner, isOwner,
getPortalInviteLink, getPortalInviteLink,
isPaidUserLimit, isUserTariffLimit,
}; };
}, },
)(observer(ExternalLinks)); )(observer(ExternalLinks));

View File

@ -96,7 +96,7 @@ const InviteInput = ({
standalone, standalone,
isPaidUserAccess, isPaidUserAccess,
setInvitePaidUsersCount, setInvitePaidUsersCount,
isPaidUserLimit, isUserTariffLimit,
}) => { }) => {
const isPublicRoomType = roomType === RoomsType.PublicRoom; const isPublicRoomType = roomType === RoomsType.PublicRoom;
@ -148,7 +148,7 @@ const InviteInput = ({
const itemsArray = addresses.map((address) => { const itemsArray = addresses.map((address) => {
if (isPaidAccess) { if (isPaidAccess) {
if (isPaidUserLimit) { if (isUserTariffLimit) {
const FreeUser = isAccounts const FreeUser = isAccounts
? EmployeeType.Guest ? EmployeeType.Guest
: getTopFreeRole(t, roomType)?.access; : getTopFreeRole(t, roomType)?.access;
@ -178,7 +178,7 @@ const InviteInput = ({
} }
if (isPaidAccess) { if (isPaidAccess) {
if (isPaidUserLimit) { if (isUserTariffLimit) {
const FreeUser = isAccounts const FreeUser = isAccounts
? EmployeeType.Guest ? EmployeeType.Guest
: getTopFreeRole(t, roomType)?.access; : getTopFreeRole(t, roomType)?.access;
@ -312,7 +312,11 @@ const InviteInput = ({
}); });
} }
if (isPaidUserLimit && item.isVisitor && isPaidUserRole(item.access)) { if (
isUserTariffLimit &&
item.isVisitor &&
isPaidUserRole(item.access)
) {
const freeRole = getTopFreeRole(t, roomType)?.access; const freeRole = getTopFreeRole(t, roomType)?.access;
if (freeRole) { if (freeRole) {
@ -382,7 +386,7 @@ const InviteInput = ({
} }
if ( if (
isPaidUserLimit && isUserTariffLimit &&
(!u.avatar || u.isVisitor) && (!u.avatar || u.isVisitor) &&
isPaidUserRole(u.access) isPaidUserRole(u.access)
) { ) {
@ -625,7 +629,7 @@ const InviteInput = ({
isOwner={isOwner} isOwner={isOwner}
isMobileView={isMobileView} isMobileView={isMobileView}
{...(roomId === -1 && { {...(roomId === -1 && {
isSelectionDisabled: isPaidUserLimit, isSelectionDisabled: isUserTariffLimit,
selectionErrorText: <PaidQuotaLimitError />, selectionErrorText: <PaidQuotaLimitError />,
})} })}
/> />
@ -669,7 +673,7 @@ export default inject(
} = dialogsStore; } = dialogsStore;
const { culture: language, standalone } = settingsStore; const { culture: language, standalone } = settingsStore;
const { isPaidUserLimit } = currentQuotaStore; const { isUserTariffLimit } = currentQuotaStore;
return { return {
language, language,
setInviteLanguage, setInviteLanguage,
@ -683,7 +687,7 @@ export default inject(
standalone, standalone,
isPaidUserAccess, isPaidUserAccess,
setInvitePaidUsersCount, setInvitePaidUsersCount,
isPaidUserLimit, isUserTariffLimit,
}; };
}, },
)( )(

View File

@ -71,7 +71,7 @@ const Item = ({
standalone, standalone,
isPaidUserAccess, isPaidUserAccess,
setInvitePaidUsersCount, setInvitePaidUsersCount,
isPaidUserLimit, isUserTariffLimit,
roomId, roomId,
}) => { }) => {
const { const {
@ -269,7 +269,7 @@ const Item = ({
isMobileView={isMobileView} isMobileView={isMobileView}
noBorder noBorder
{...((roomId === -1 || !avatar || isVisitor) && { {...((roomId === -1 || !avatar || isVisitor) && {
isSelectionDisabled: isPaidUserLimit, isSelectionDisabled: isUserTariffLimit,
selectionErrorText: <PaidQuotaLimitError />, selectionErrorText: <PaidQuotaLimitError />,
availableAccess, availableAccess,
})} })}
@ -307,12 +307,12 @@ const Item = ({
export default inject(({ dialogsStore, currentQuotaStore }) => { export default inject(({ dialogsStore, currentQuotaStore }) => {
const { isPaidUserAccess, setInvitePaidUsersCount, invitePanelOptions } = const { isPaidUserAccess, setInvitePaidUsersCount, invitePanelOptions } =
dialogsStore; dialogsStore;
const { isPaidUserLimit } = currentQuotaStore; const { isUserTariffLimit } = currentQuotaStore;
return { return {
isPaidUserAccess, isPaidUserAccess,
setInvitePaidUsersCount, setInvitePaidUsersCount,
isPaidUserLimit, isUserTariffLimit,
roomId: invitePanelOptions.roomId, roomId: invitePanelOptions.roomId,
}; };
})(observer(Item)); })(observer(Item));

View File

@ -329,15 +329,11 @@ class CurrentQuotasStore {
if (this.maxCountManagersByQuota === PortalFeaturesLimitations.Limitless) if (this.maxCountManagersByQuota === PortalFeaturesLimitations.Limitless)
return false; return false;
return this.isPaidUserLimit;
}
get isPaidUserLimit() {
return this.addedManagersCount >= this.maxCountManagersByQuota; return this.addedManagersCount >= this.maxCountManagersByQuota;
} }
showWarningDialog = (type: number) => { showWarningDialog = (type: number) => {
if (type && this.isPaidUserLimit && type !== EmployeeType.Guest) if (type && this.isUserTariffLimit && type !== EmployeeType.Guest)
return true; return true;
return this.currentTariffStatusStore?.isGracePeriod; return this.currentTariffStatusStore?.isGracePeriod;