Fix an issue where polls with 'expires_at' not set expired (#12222)

This commit is contained in:
Takeshi Umeda 2019-10-27 20:45:55 +09:00 committed by Eugen Rochko
parent fdda54272d
commit 6665362f10

View file

@ -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 };
}