mirror of
https://github.com/mastodon/mastodon.git
synced 2026-08-28 07:26:40 -05:00
Fix being unable to vote in polls without an expiration date (#39949)
This commit is contained in:
@@ -9,7 +9,7 @@ export interface ApiPollOptionJSON {
|
||||
|
||||
export interface ApiPollJSON {
|
||||
id: string;
|
||||
expires_at: string;
|
||||
expires_at: string | null;
|
||||
expired: boolean;
|
||||
multiple: boolean;
|
||||
votes_count: number;
|
||||
|
||||
@@ -59,10 +59,13 @@ export const Poll: React.FC<PollProps> = ({ pollId, disabled, status }) => {
|
||||
return false;
|
||||
}
|
||||
const expiresAt = poll.expires_at;
|
||||
return poll.expired || new Date(expiresAt).getTime() < Date.now();
|
||||
return (
|
||||
poll.expired ||
|
||||
(expiresAt !== null && new Date(expiresAt).getTime() < Date.now())
|
||||
);
|
||||
}, [poll]);
|
||||
const timeRemaining = useMemo(() => {
|
||||
if (!poll) {
|
||||
if (!poll?.expires_at) {
|
||||
return null;
|
||||
}
|
||||
if (expired) {
|
||||
|
||||
Reference in New Issue
Block a user