diff --git a/packages/page-bounties/src/Bounties.spec.ts b/packages/page-bounties/src/Bounties.spec.ts index 3ccc261420..c5295c8beb 100644 --- a/packages/page-bounties/src/Bounties.spec.ts +++ b/packages/page-bounties/src/Bounties.spec.ts @@ -27,8 +27,12 @@ jest.mock('@polkadot/react-hooks/useTreasury', () => ({ useTreasury: () => mockHooks.treasury })); -jest.mock('@polkadot/react-hooks/useMembers', () => ({ - useMembers: () => mockHooks.members +jest.mock('@polkadot/react-hooks/useCollectiveInstance', () => ({ + useCollectiveInstance: () => 'council' +})); + +jest.mock('@polkadot/react-hooks/useCollectiveMembers', () => ({ + useCollectiveMembers: () => mockHooks.members })); jest.mock('@polkadot/react-hooks/useBlockTime', () => ({ diff --git a/packages/page-bounties/src/BountyActions/BountyInitiateVoting.tsx b/packages/page-bounties/src/BountyActions/BountyInitiateVoting.tsx index 2ebe5706b2..3a7876f730 100644 --- a/packages/page-bounties/src/BountyActions/BountyInitiateVoting.tsx +++ b/packages/page-bounties/src/BountyActions/BountyInitiateVoting.tsx @@ -9,7 +9,7 @@ import React, { useEffect, useMemo, useRef, useState } from 'react'; import { getTreasuryProposalThreshold } from '@polkadot/apps-config'; import { Button, InputAddress, Modal, TxButton } from '@polkadot/react-components'; -import { useApi, useMembers, useToggle } from '@polkadot/react-hooks'; +import { useApi, useCollectiveInstance, useCollectiveMembers, useToggle } from '@polkadot/react-hooks'; import { truncateTitle } from '../helpers'; import { useBounties } from '../hooks'; @@ -26,7 +26,8 @@ const BOUNTY_METHODS = ['approveBounty', 'closeBounty']; function BountyInitiateVoting ({ description, index, proposals }: Props): React.ReactElement | null { const { t } = useTranslation(); const { api } = useApi(); - const { isMember, members } = useMembers('council'); + const { isMember, members } = useCollectiveMembers('council'); + const councilMod = useCollectiveInstance('council'); const { approveBounty, closeBounty } = useBounties(); const [isOpen, toggleOpen] = useToggle(); const [accountId, setAccountId] = useState(null); @@ -43,7 +44,7 @@ function BountyInitiateVoting ({ description, index, proposals }: Props): React. const isVotingInitiated = useMemo(() => proposals?.filter(({ proposal }) => BOUNTY_METHODS.includes(proposal.method)).length !== 0, [proposals]); - return isMember && !isVotingInitiated + return isMember && !isVotingInitiated && councilMod ? ( <>