[REM] Remove usage of voters_count for polls which seems to be broken on pleroma/akkoma (#162)

This commit is contained in:
Clovis 2023-01-15 12:56:17 +01:00 committed by GitHub
parent b9b2bfee60
commit fc0fd45708
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 9 deletions

View File

@ -37,14 +37,7 @@ const PollFooter: React.FC<IPollFooter> = ({ poll, showResults, selected }): JSX
intl.formatMessage(messages.closed) :
<RelativeTimestamp weight='medium' timestamp={poll.expires_at} futureDate />;
let votesCount = null;
if (poll.voters_count !== null && poll.voters_count !== undefined) {
votesCount = <FormattedMessage id='poll.total_people' defaultMessage='{count, plural, one {# person} other {# people}}' values={{ count: poll.get('voters_count') }} />;
} else {
votesCount = <FormattedMessage id='poll.total_votes' defaultMessage='{count, plural, one {# vote} other {# votes}}' values={{ count: poll.get('votes_count') }} />;
}
const votesCount = <FormattedMessage id='poll.total_votes' defaultMessage='{count, plural, one {# vote} other {# votes}}' values={{ count: poll.get('votes_count') }} />;
return (
<Stack space={4} data-testid='poll-footer'>

View File

@ -114,7 +114,7 @@ const PollOption: React.FC<IPollOption> = (props): JSX.Element | null => {
if (!poll) return null;
const pollVotesCount = poll.voters_count || poll.votes_count;
const pollVotesCount = 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);