[Glitch] Fix an issue where polls with 'expires_at' not set expired

Port 5b46467474 to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
master
Takeshi Umeda 5 years ago committed by Thibaut Girka
parent 0ae7d84273
commit f2fc7246e1
  1. 3
      app/javascript/flavours/glitch/components/poll.js

@ -39,7 +39,8 @@ class Poll extends ImmutablePureComponent {
static getDerivedStateFromProps (props, state) { static getDerivedStateFromProps (props, state) {
const { poll, intl } = props; 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 }; return (expired === state.expired) ? null : { expired };
} }

Loading…
Cancel
Save