mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
fix: can review CR with skip change request (#3998)
This commit is contained in:
parent
dcac61e4d9
commit
ce6ff2578a
@ -83,13 +83,14 @@ export const ChangeRequestOverview: FC = () => {
|
||||
const { refetch: refetchChangeRequestOpen } =
|
||||
usePendingChangeRequests(projectId);
|
||||
const { setToastData, setToastApiError } = useToast();
|
||||
const { isChangeRequestConfigured } = useChangeRequestsEnabled(projectId);
|
||||
const { isChangeRequestConfiguredForReview } =
|
||||
useChangeRequestsEnabled(projectId);
|
||||
|
||||
if (!changeRequest) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const allowChangeRequestActions = isChangeRequestConfigured(
|
||||
const allowChangeRequestActions = isChangeRequestConfiguredForReview(
|
||||
changeRequest.environment
|
||||
);
|
||||
|
||||
|
@ -25,6 +25,18 @@ export const useChangeRequestsEnabled = (projectId: string) => {
|
||||
[JSON.stringify(data)]
|
||||
);
|
||||
|
||||
const isChangeRequestConfiguredForReview = React.useCallback(
|
||||
(environment: string): boolean => {
|
||||
return data.some(draft => {
|
||||
return (
|
||||
draft.environment === environment &&
|
||||
draft.changeRequestEnabled
|
||||
);
|
||||
});
|
||||
},
|
||||
[JSON.stringify(data)]
|
||||
);
|
||||
|
||||
const isChangeRequestConfiguredInAnyEnv = React.useCallback((): boolean => {
|
||||
return data.some(draft => draft.changeRequestEnabled);
|
||||
}, [JSON.stringify(data)]);
|
||||
@ -32,5 +44,6 @@ export const useChangeRequestsEnabled = (projectId: string) => {
|
||||
return {
|
||||
isChangeRequestConfigured,
|
||||
isChangeRequestConfiguredInAnyEnv,
|
||||
isChangeRequestConfiguredForReview,
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user