diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cd914d2..922a0702 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ changes. - Correctly show all kinds of votes in the modal showing vote numbers [Issue 1941](https://github.com/IntersectMBO/govtool/issues/1941) - Fixed terms and conditions link [Issue 1968](https://github.com/IntersectMBO/govtool/issues/1968) - Hide Delegate button in DRep list and details if user has already delegated to this DRep [Issue 1982](https://github.com/IntersectMBO/govtool/issues/1982) +- Fix condition for disabling voting on different GA types [Issue 2008](https://github.com/IntersectMBO/govtool/issues/2008) ### Changed diff --git a/govtool/frontend/src/context/featureFlag.tsx b/govtool/frontend/src/context/featureFlag.tsx index 8e972a35..f655ca9c 100644 --- a/govtool/frontend/src/context/featureFlag.tsx +++ b/govtool/frontend/src/context/featureFlag.tsx @@ -10,16 +10,6 @@ import { GovernanceActionType } from "@/types/governanceAction"; import { useAppContext } from "./appContext"; -const govActionVotingEnabledSinceProtocolVersion = { - [GovernanceActionType.InfoAction]: 9, - // TODO: Add minimum protocol versions for the following actions - [GovernanceActionType.HardForkInitiation]: Number.MAX_SAFE_INTEGER, - [GovernanceActionType.NewCommittee]: Number.MAX_SAFE_INTEGER, - [GovernanceActionType.NewConstitution]: Number.MAX_SAFE_INTEGER, - [GovernanceActionType.NoConfidence]: Number.MAX_SAFE_INTEGER, - [GovernanceActionType.ParameterChange]: Number.MAX_SAFE_INTEGER, - [GovernanceActionType.TreasuryWithdrawals]: Number.MAX_SAFE_INTEGER, -}; /** * The feature flag context type. */ @@ -41,7 +31,7 @@ const FeatureFlagContext = createContext({ * @param children - The child components to render. */ const FeatureFlagProvider = ({ children }: PropsWithChildren) => { - const { epochParams, isAppInitializing } = useAppContext(); + const { isAppInitializing, isInBootstrapPhase } = useAppContext(); /** * Determines if voting on a governance action is enabled based on the protocol version. @@ -50,9 +40,9 @@ const FeatureFlagProvider = ({ children }: PropsWithChildren) => { */ const isVotingOnGovernanceActionEnabled = useCallback( (governanceActionType: GovernanceActionType) => - (epochParams?.protocol_major || 0) >= - govActionVotingEnabledSinceProtocolVersion[governanceActionType], - [isAppInitializing], + governanceActionType === GovernanceActionType.InfoAction || + !isInBootstrapPhase, + [isAppInitializing, isInBootstrapPhase], ); const value = useMemo(