]> cat aescling's git repositories - mastodon.git/commitdiff
Fix an issue where polls with 'expires_at' not set expired (#12222)
authorTakeshi Umeda <noel.yoshiba@gmail.com>
Sun, 27 Oct 2019 11:45:55 +0000 (20:45 +0900)
committerEugen Rochko <eugen@zeonfederated.com>
Sun, 27 Oct 2019 11:45:55 +0000 (12:45 +0100)
app/javascript/mastodon/components/poll.js

index cdbcf8f709fdf0572dd1d70f6e68b06763f11a90..0edd064e06b1769d9f6b690ab6dfa7b9720247bd 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 };
   }