Skip to content

Commit 5b46467

Browse files
noellaboGargron
authored andcommitted
Fix an issue where polls with 'expires_at' not set expired (mastodon#12222)
1 parent 7512f3a commit 5b46467

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • app/javascript/mastodon/components

app/javascript/mastodon/components/poll.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ class Poll extends ImmutablePureComponent {
3939

4040
static getDerivedStateFromProps (props, state) {
4141
const { poll, intl } = props;
42-
const expired = poll.get('expired') || (new Date(poll.get('expires_at'))).getTime() < intl.now();
42+
const expires_at = poll.get('expires_at');
43+
const expired = poll.get('expired') || expires_at !== null && (new Date(expires_at)).getTime() < intl.now();
4344
return (expired === state.expired) ? null : { expired };
4445
}
4546

0 commit comments

Comments
 (0)