mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
fix: copy strategy change request (#2430)
* Fixes a bug where turning off change requests would not turn off change request for copy strategy
This commit is contained in:
parent
49fc31883c
commit
89f2d81253
@ -19,10 +19,10 @@ import useFeatureStrategyApi from 'hooks/api/actions/useFeatureStrategyApi/useFe
|
||||
import useToast from 'hooks/useToast';
|
||||
import { useFeatureImmutable } from 'hooks/api/getters/useFeature/useFeatureImmutable';
|
||||
import { formatUnknownError } from 'utils/formatUnknownError';
|
||||
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
||||
import { useChangeRequestAddStrategy } from 'hooks/useChangeRequestAddStrategy';
|
||||
import { ChangeRequestDialogue } from '../../../../../../../../../changeRequest/ChangeRequestConfirmDialog/ChangeRequestConfirmDialog';
|
||||
import { CopyStrategyMessage } from '../../../../../../../../../changeRequest/ChangeRequestConfirmDialog/ChangeRequestMessages/CopyStrategyMessage';
|
||||
import { useChangeRequestsEnabled } from 'hooks/useChangeRequestsEnabled';
|
||||
|
||||
interface ICopyStrategyIconMenuProps {
|
||||
environmentId: string;
|
||||
@ -51,8 +51,7 @@ export const CopyStrategyIconMenu: VFC<ICopyStrategyIconMenuProps> = ({
|
||||
setAnchorEl(null);
|
||||
};
|
||||
const { hasAccess } = useContext(AccessContext);
|
||||
const { uiConfig } = useUiConfig();
|
||||
const changeRequestsEnabled = uiConfig?.flags?.changeRequests;
|
||||
const { isChangeRequestConfigured } = useChangeRequestsEnabled(projectId);
|
||||
|
||||
const {
|
||||
changeRequestDialogDetails,
|
||||
@ -67,7 +66,7 @@ export const CopyStrategyIconMenu: VFC<ICopyStrategyIconMenuProps> = ({
|
||||
environment,
|
||||
copyOf: strategy.id,
|
||||
};
|
||||
if (changeRequestsEnabled) {
|
||||
if (isChangeRequestConfigured(environmentId)) {
|
||||
await onChangeRequestAddStrategy(
|
||||
environment,
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user