Skip to content

Commit 8fa5486

Browse files
ClearlyClairehiyuki2578
authored andcommitted
Display closed polls as such (mastodon#10156)
1 parent f7205ac commit 8fa5486

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • app/javascript/mastodon/components

app/javascript/mastodon/components/poll.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const messages = defineMessages({
1414
minutes: { id: 'time_remaining.minutes', defaultMessage: '{number, plural, one {# minute} other {# minutes}} left' },
1515
hours: { id: 'time_remaining.hours', defaultMessage: '{number, plural, one {# hour} other {# hours}} left' },
1616
days: { id: 'time_remaining.days', defaultMessage: '{number, plural, one {# day} other {# days}} left' },
17+
closed: { id: 'poll.closed', defaultMessage: 'Closed' },
1718
});
1819

1920
const SECOND = 1000;
@@ -132,7 +133,7 @@ class Poll extends ImmutablePureComponent {
132133
return null;
133134
}
134135

135-
const timeRemaining = timeRemainingString(intl, new Date(poll.get('expires_at')), intl.now());
136+
const timeRemaining = poll.get('expired') ? intl.formatMessage(messages.closed) : timeRemainingString(intl, new Date(poll.get('expires_at')), intl.now());
136137
const showResults = poll.get('voted') || poll.get('expired');
137138
const disabled = this.props.disabled || Object.entries(this.state.selected).every(item => !item);
138139

0 commit comments

Comments
 (0)