about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTakeshi Umeda <noel.yoshiba@gmail.com>2019-10-27 20:45:55 +0900
committerEugen Rochko <eugen@zeonfederated.com>2019-10-27 12:45:55 +0100
commit5b46467474dd88e1563561bf50643324b4f021e8 (patch)
tree806d30abfb485b01dc6cfa3946a6da86ce031593
parent7512f3a3e0a5cabb233e990d67e6138dfcdcd4fa (diff)
Fix an issue where polls with 'expires_at' not set expired (#12222)
-rw-r--r--app/javascript/mastodon/components/poll.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/javascript/mastodon/components/poll.js b/app/javascript/mastodon/components/poll.js
index cdbcf8f70..0edd064e0 100644
--- a/app/javascript/mastodon/components/poll.js
+++ b/app/javascript/mastodon/components/poll.js
@@ -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 };
   }