diff --git a/app/soapbox/components/polls/poll-footer.tsx b/app/soapbox/components/polls/poll-footer.tsx index bfa105ebd..c7997cfd7 100644 --- a/app/soapbox/components/polls/poll-footer.tsx +++ b/app/soapbox/components/polls/poll-footer.tsx @@ -36,6 +36,15 @@ const PollFooter: React.FC = ({ poll, showResults, selected }): JSX intl.formatMessage(messages.closed) : ; + let votesCount = null; + + if (poll.voters_count !== null && poll.voters_count !== undefined) { + votesCount = ; + } else { + votesCount = ; + } + + return ( {(!showResults && poll?.multiple) && ( @@ -58,11 +67,7 @@ const PollFooter: React.FC = ({ poll, showResults, selected }): JSX )} - + {votesCount} {poll.expires_at && ( diff --git a/app/soapbox/components/polls/poll-option.tsx b/app/soapbox/components/polls/poll-option.tsx index b242f649b..024f01b7b 100644 --- a/app/soapbox/components/polls/poll-option.tsx +++ b/app/soapbox/components/polls/poll-option.tsx @@ -110,7 +110,8 @@ const PollOption: React.FC = (props): JSX.Element | null => { if (!poll) return null; - const percent = poll.votes_count === 0 ? 0 : (option.votes_count / poll.votes_count) * 100; + const pollVotesCount = poll.voters_count || poll.votes_count; + const percent = pollVotesCount === 0 ? 0 : (option.votes_count / pollVotesCount) * 100; const leading = poll.options.filterNot(other => other.title === option.title).every(other => option.votes_count >= other.votes_count); const voted = poll.own_votes?.includes(index); const message = intl.formatMessage(messages.votes, { votes: option.votes_count });