]> cat aescling's git repositories - mastodon.git/commitdiff
[Glitch] Fix an issue where polls with 'expires_at' not set expired
authorTakeshi Umeda <noel.yoshiba@gmail.com>
Sun, 27 Oct 2019 11:45:55 +0000 (20:45 +0900)
committerThibaut Girka <thib@sitedethib.com>
Wed, 6 Nov 2019 13:49:43 +0000 (14:49 +0100)
Port 5b46467474dd88e1563561bf50643324b4f021e8 to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
app/javascript/flavours/glitch/components/poll.js

index a7f9a97dae8e65f19c885ae90cf20659f9edb248..2d2a7cbe012b8a4b7ad03c221371b6e8d31df42c 100644 (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 };
   }