add further check for ability to expand.
Этот коммит содержится в:
@@ -16,6 +16,7 @@ import {STORAGE_KEY_EXPANSION_IN_PROGRESS} from 'components/self_hosted_expansio
|
|||||||
import SelfHostedExpansionModal from 'components/self_hosted_expansion_modal';
|
import SelfHostedExpansionModal from 'components/self_hosted_expansion_modal';
|
||||||
|
|
||||||
import {useControlModal, ControlModal} from './useControlModal';
|
import {useControlModal, ControlModal} from './useControlModal';
|
||||||
|
import useCanSelfHostedExpand from './useCanSelfHostedExpand';
|
||||||
|
|
||||||
interface HookOptions{
|
interface HookOptions{
|
||||||
onClick?: () => void;
|
onClick?: () => void;
|
||||||
@@ -25,6 +26,7 @@ interface HookOptions{
|
|||||||
export default function useControlSelfHostedExpansionModal(options: HookOptions): ControlModal {
|
export default function useControlSelfHostedExpansionModal(options: HookOptions): ControlModal {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const currentUser = useSelector(getCurrentUser);
|
const currentUser = useSelector(getCurrentUser);
|
||||||
|
const canExpand = useCanSelfHostedExpand();
|
||||||
const controlModal = useControlModal({
|
const controlModal = useControlModal({
|
||||||
modalId: ModalIdentifiers.SELF_HOSTED_EXPANSION,
|
modalId: ModalIdentifiers.SELF_HOSTED_EXPANSION,
|
||||||
dialogType: SelfHostedExpansionModal,
|
dialogType: SelfHostedExpansionModal,
|
||||||
@@ -34,6 +36,10 @@ export default function useControlSelfHostedExpansionModal(options: HookOptions)
|
|||||||
return {
|
return {
|
||||||
...controlModal,
|
...controlModal,
|
||||||
open: async () => {
|
open: async () => {
|
||||||
|
if (!canExpand) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const purchaseInProgress = localStorage.getItem(STORAGE_KEY_EXPANSION_IN_PROGRESS) === 'true';
|
const purchaseInProgress = localStorage.getItem(STORAGE_KEY_EXPANSION_IN_PROGRESS) === 'true';
|
||||||
|
|
||||||
// check if user already has an open purchase modal in current browser.
|
// check if user already has an open purchase modal in current browser.
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user