about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/components/poll.js
diff options
context:
space:
mode:
authorTakeshi Umeda <noel.yoshiba@gmail.com>2019-10-27 20:45:55 +0900
committerThibaut Girka <thib@sitedethib.com>2019-11-06 14:49:43 +0100
commitf2fc7246e12266b9dc4eff682b054372782e986c (patch)
tree5aff91a9e7e5dde0b18ec7fcced6d2af48551e56 /app/javascript/flavours/glitch/components/poll.js
parent0ae7d8427394d5f98fb2bd78eaae9bf848831186 (diff)
[Glitch] Fix an issue where polls with 'expires_at' not set expired
Port 5b46467474dd88e1563561bf50643324b4f021e8 to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
Diffstat (limited to 'app/javascript/flavours/glitch/components/poll.js')
-rw-r--r--app/javascript/flavours/glitch/components/poll.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/components/poll.js b/app/javascript/flavours/glitch/components/poll.js
index a7f9a97da..2d2a7cbe0 100644
--- a/app/javascript/flavours/glitch/components/poll.js
+++ b/app/javascript/flavours/glitch/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 };
   }