Ensure tech. comm is filtered by members (#3742)

This commit is contained in:
Jaco Greeff 2020-09-23 08:36:11 +02:00 committed by GitHub
parent 95a8177df2
commit 3eaac6b81d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View File

@ -90,6 +90,7 @@ function Proposal ({ className = '', imageHash, members, prime }: Props): React.
{isVoteable && !isCloseable && (
<Voting
hash={imageHash}
members={members}
prime={prime}
proposalId={index}
/>

View File

@ -12,11 +12,12 @@ import { useTranslation } from '../translate';
interface Props {
hash: Hash | string;
members: string[];
prime?: AccountId | null;
proposalId: BN | number;
}
function Voting ({ hash, prime, proposalId }: Props): React.ReactElement<Props> | null {
function Voting ({ hash, members, prime, proposalId }: Props): React.ReactElement<Props> | null {
const { t } = useTranslation();
const { hasAccounts } = useAccounts();
const [accountId, setAccountId] = useState<string | null>(null);
@ -26,8 +27,6 @@ function Voting ({ hash, prime, proposalId }: Props): React.ReactElement<Props>
return null;
}
const isPrime = accountId === prime?.toString();
return (
<>
{isVotingOpen && (
@ -36,8 +35,11 @@ function Voting ({ hash, prime, proposalId }: Props): React.ReactElement<Props>
size='small'
>
<Modal.Content>
<VoteAccount onChange={setAccountId} />
{isPrime && (
<VoteAccount
filter={members}
onChange={setAccountId}
/>
{(accountId === prime?.toString()) && (
<article className='warning'>
<div>{t<string>('You are voting with this collective\'s prime account. The vote will be the default outcome in case of any abstentions.')}</div>
</article>