Support infinite voting time for remote polls
Signed-off-by: Marcin Mikołajczak <git@mkljczk.pl> Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
ded13132ff
commit
3406ce043c
2 changed files with 7 additions and 5 deletions
|
@ -33,9 +33,11 @@ const PollFooter: React.FC<IPollFooter> = ({ poll, showResults, selected }): JSX
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
};
|
};
|
||||||
|
|
||||||
const timeRemaining = poll.expired ?
|
const timeRemaining = poll.expires_at && (
|
||||||
intl.formatMessage(messages.closed) :
|
poll.expired ?
|
||||||
<RelativeTimestamp weight='medium' timestamp={poll.expires_at} futureDate />;
|
intl.formatMessage(messages.closed) :
|
||||||
|
<RelativeTimestamp weight='medium' timestamp={poll.expires_at} futureDate />
|
||||||
|
);
|
||||||
|
|
||||||
let votesCount = null;
|
let votesCount = null;
|
||||||
|
|
||||||
|
@ -82,7 +84,7 @@ const PollFooter: React.FC<IPollFooter> = ({ poll, showResults, selected }): JSX
|
||||||
{votesCount}
|
{votesCount}
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
{poll.expires_at && (
|
{poll.expires_at !== null && (
|
||||||
<>
|
<>
|
||||||
<Text theme='muted'>·</Text>
|
<Text theme='muted'>·</Text>
|
||||||
<Text weight='medium' theme='muted' data-testid='poll-expiration'>{timeRemaining}</Text>
|
<Text weight='medium' theme='muted' data-testid='poll-expiration'>{timeRemaining}</Text>
|
||||||
|
|
|
@ -14,7 +14,7 @@ const pollOptionSchema = z.object({
|
||||||
const pollSchema = z.object({
|
const pollSchema = z.object({
|
||||||
emojis: filteredArray(customEmojiSchema),
|
emojis: filteredArray(customEmojiSchema),
|
||||||
expired: z.boolean().catch(false),
|
expired: z.boolean().catch(false),
|
||||||
expires_at: z.string().datetime().catch(new Date().toUTCString()),
|
expires_at: z.string().datetime().nullable().catch(null),
|
||||||
id: z.string(),
|
id: z.string(),
|
||||||
multiple: z.boolean().catch(false),
|
multiple: z.boolean().catch(false),
|
||||||
options: z.array(pollOptionSchema).min(2),
|
options: z.array(pollOptionSchema).min(2),
|
||||||
|
|
Loading…
Reference in a new issue