From 0a29988edfb2a71a34ae31f35a33e7f278402440 Mon Sep 17 00:00:00 2001 From: Takeshi Umeda Date: Sun, 27 Oct 2019 20:45:55 +0900 Subject: [PATCH] [Glitch] Fix an issue where polls with 'expires_at' not set expired Port 6665362f10cc7f0af5fff7461b986b04f822bd75 to glitch-soc Signed-off-by: Thibaut Girka --- app/javascript/flavours/glitch/components/poll.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/javascript/flavours/glitch/components/poll.js b/app/javascript/flavours/glitch/components/poll.js index a7f9a97dae..2d2a7cbe01 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 }; }