about summary refs log tree commit diff
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-03-04 22:52:41 +0100
committerThibaut Girka <thib@sitedethib.com>2019-03-05 21:35:03 +0100
commit7f27ee35a811c596522513efc0d5e38d85008d04 (patch)
treed14ca1b36a38c4e340365d5c7f6ee5fd288d213f
parent530151466e8431d048d97992c648e46272754f4e (diff)
Display closed polls as such
Port cda6ece760f08974e6118887641e6cc8c0f8c9e0 to glitch-soc
-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 45ce107aa..e9124aefa 100644
--- a/app/javascript/flavours/glitch/components/poll.js
+++ b/app/javascript/flavours/glitch/components/poll.js
@@ -14,6 +14,7 @@ const messages = defineMessages({
   minutes: { id: 'time_remaining.minutes', defaultMessage: '{number, plural, one {# minute} other {# minutes}} left' },
   hours: { id: 'time_remaining.hours', defaultMessage: '{number, plural, one {# hour} other {# hours}} left' },
   days: { id: 'time_remaining.days', defaultMessage: '{number, plural, one {# day} other {# days}} left' },
+  closed: { id: 'poll.closed', defaultMessage: 'Closed' },
 });
 
 const SECOND = 1000;
@@ -132,7 +133,7 @@ class Poll extends ImmutablePureComponent {
       return null;
     }
 
-    const timeRemaining = timeRemainingString(intl, new Date(poll.get('expires_at')), intl.now());
+    const timeRemaining = poll.get('expired') ? intl.formatMessage(messages.closed) : timeRemainingString(intl, new Date(poll.get('expires_at')), intl.now());
     const showResults   = poll.get('voted') || poll.get('expired');
     const disabled      = this.props.disabled || Object.entries(this.state.selected).every(item => !item);