diff --git a/app/javascript/flavours/glitch/components/poll.jsx b/app/javascript/flavours/glitch/components/poll.jsx index eca7b5c525..623d343806 100644 --- a/app/javascript/flavours/glitch/components/poll.jsx +++ b/app/javascript/flavours/glitch/components/poll.jsx @@ -131,6 +131,10 @@ class Poll extends ImmutablePureComponent { this.props.refresh(); }; + handleReveal = () => { + this.setState({ revealed: true }); + } + renderOption (option, optionIndex, showResults) { const { poll, lang, disabled, intl } = this.props; const pollVotesCount = poll.get('voters_count') || poll.get('votes_count'); @@ -206,14 +210,14 @@ class Poll extends ImmutablePureComponent { render () { const { poll, intl } = this.props; - const { expired } = this.state; + const { revealed, expired } = this.state; if (!poll) { return null; } const timeRemaining = expired ? intl.formatMessage(messages.closed) : ; - const showResults = poll.get('voted') || expired; + const showResults = poll.get('voted') || revealed || expired; const disabled = this.props.disabled || Object.entries(this.state.selected).every(item => !item); let votesCount = null; @@ -232,9 +236,10 @@ class Poll extends ImmutablePureComponent {
{!showResults && } - {showResults && !this.props.disabled && · } + {!showResults && <> · } + {showResults && !this.props.disabled && <> · } {votesCount} - {poll.get('expires_at') && · {timeRemaining}} + {poll.get('expires_at') && <> · {timeRemaining}}
);