No voting for Fasttrack when members <= 1 (#7658)

* No voting for Fasttrack when members <= 1

* Don't include in batch
This commit is contained in:
Jaco 2022-05-30 11:40:00 +02:00 committed by GitHub
parent 9d046c0281
commit 76aad8360b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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<string>('threshold')}
/>
</Modal.Columns>
<Modal.Columns hint={t<string>('Submit an Aye vote alongside the proposal as part of a batch')}>
<Toggle
label={t<string>('Submit Aye vote with proposal')}
onChange={toggleVote}
value={withVote}
/>
</Modal.Columns>
{(members.length > 1) && (
<Modal.Columns hint={t<string>('Submit an Aye vote alongside the proposal as part of a batch')}>
<Toggle
label={t<string>('Submit Aye vote with proposal')}
onChange={toggleVote}
value={withVote}
/>
</Modal.Columns>
)}
</Modal.Content>
<Modal.Actions>
<TxButton