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

View File

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

View File

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

View File

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