Browse Source

Fix web UI crash on page load when detailed status has a poll

Port 5dfa433698 to glitch-soc
closed-social-glitch-2
Eugen Rochko 5 years ago
committed by Thibaut Girka
parent
commit
f14eda23e9
1 changed files with 9 additions and 4 deletions
  1. +9
    -4
      app/javascript/flavours/glitch/components/poll.js

+ 9
- 4
app/javascript/flavours/glitch/components/poll.js View File

@ -45,7 +45,7 @@ export default @injectIntl
class Poll extends ImmutablePureComponent {
static propTypes = {
poll: ImmutablePropTypes.map.isRequired,
poll: ImmutablePropTypes.map,
intl: PropTypes.object.isRequired,
dispatch: PropTypes.func,
disabled: PropTypes.bool,
@ -122,9 +122,14 @@ class Poll extends ImmutablePureComponent {
render () {
const { poll, intl } = this.props;
const timeRemaining = timeRemainingString(intl, new Date(poll.get('expires_at')), intl.now());
const showResults = poll.get('voted') || poll.get('expired');
const disabled = this.props.disabled || Object.entries(this.state.selected).every(item => !item);
if (!poll) {
return null;
}
const timeRemaining = timeRemainingString(intl, new Date(poll.get('expires_at')), intl.now());
const showResults = poll.get('voted') || poll.get('expired');
const disabled = this.props.disabled || Object.entries(this.state.selected).every(item => !item);
return (
<div className='poll'>

Loading…
Cancel
Save