From 76aad8360b82f8bd1b6499c14917cd52b71ff5be Mon Sep 17 00:00:00 2001 From: Jaco Date: Mon, 30 May 2022 11:40:00 +0200 Subject: [PATCH] No voting for Fasttrack when members <= 1 (#7658) * No voting for Fasttrack when members <= 1 * Don't include in batch --- .../page-democracy/src/Overview/Fasttrack.tsx | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/packages/page-democracy/src/Overview/Fasttrack.tsx b/packages/page-democracy/src/Overview/Fasttrack.tsx index 39c6bd6bbe..53cf0f5451 100644 --- a/packages/page-democracy/src/Overview/Fasttrack.tsx +++ b/packages/page-democracy/src/Overview/Fasttrack.tsx @@ -62,13 +62,13 @@ function Fasttrack ({ imageHash, members, threshold }: Props): React.ReactElemen // @ts-ignore Old-type : api.tx[modLocation].propose(memberThreshold, proposal); - return withVote + return withVote && (members.length > 1) ? api.tx.utility.batch([ proposeTx, api.tx[modLocation].vote(proposal.method.hash, proposalCount, true) ]) : proposeTx; - }, [api, memberThreshold, modLocation, proposal, proposalCount, proposalLength, withVote] + }, [api, members, memberThreshold, modLocation, proposal, proposalCount, proposalLength, withVote] ); useEffect((): void => { @@ -133,13 +133,15 @@ function Fasttrack ({ imageHash, members, threshold }: Props): React.ReactElemen label={t('threshold')} /> - ('Submit an Aye vote alongside the proposal as part of a batch')}> - ('Submit Aye vote with proposal')} - onChange={toggleVote} - value={withVote} - /> - + {(members.length > 1) && ( + ('Submit an Aye vote alongside the proposal as part of a batch')}> + ('Submit Aye vote with proposal')} + onChange={toggleVote} + value={withVote} + /> + + )}