Skip to content

Commit

Permalink
Fix an issue where polls with 'expires_at' not set expired (mastodon#…
Browse files Browse the repository at this point in the history
  • Loading branch information
noellabo authored and Gargron committed Oct 27, 2019
1 parent 7512f3a commit 5b46467
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/javascript/mastodon/components/poll.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ class Poll extends ImmutablePureComponent {

static getDerivedStateFromProps (props, state) {
const { poll, intl } = props;
const expired = poll.get('expired') || (new Date(poll.get('expires_at'))).getTime() < intl.now();
const expires_at = poll.get('expires_at');
const expired = poll.get('expired') || expires_at !== null && (new Date(expires_at)).getTime() < intl.now();
return (expired === state.expired) ? null : { expired };
}

Expand Down

0 comments on commit 5b46467

Please sign in to comment.