From b6fbe71a51191ae366a01c20c669bf5a96224d27 Mon Sep 17 00:00:00 2001 From: thislight Date: Tue, 14 Jan 2025 15:21:03 +0800 Subject: [PATCH] fix #57: allow users vote even if they voted --- src/timelines/toots/TootPoll.tsx | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/timelines/toots/TootPoll.tsx b/src/timelines/toots/TootPoll.tsx index 42cbdd5..5c4fc3a 100644 --- a/src/timelines/toots/TootPoll.tsx +++ b/src/timelines/toots/TootPoll.tsx @@ -9,7 +9,7 @@ import { } from "solid-js"; import "./TootPoll.css"; import type { mastodon } from "masto"; -import { resolveCustomEmoji } from "../../masto/toot"; +import { resolveCustomEmoji } from "../../masto/toot.js"; import { Button, Checkbox, @@ -20,11 +20,11 @@ import { Radio, } from "@suid/material"; import { formatDistance, isBefore } from "date-fns"; -import { useTimeSource } from "~platform/timesrc"; -import { useDateFnLocale } from "~platform/i18n"; -import TootPollDialog from "./TootPollDialog"; -import { ANIM_CURVE_STD } from "~material/theme"; -import { useTootEnv } from "../RegularToot"; +import { useTimeSource } from "~platform/timesrc.js"; +import { useDateFnLocale } from "~platform/i18n.js"; +import TootPollDialog from "./TootPollDialog.js"; +import { ANIM_CURVE_STD } from "~material/theme.js"; +import { useTootEnv } from "../RegularToot.js"; type TootPollProps = { value: mastodon.v1.Poll; @@ -50,7 +50,12 @@ const TootPoll: Component = (props) => { return n; } - return poll().expired || poll().voted; + // TODO: More info for when is a poll available for vote + // I don't know the exact condition that the server + // prevent the user voting - say, mona allows you + // change your vote even after voted. I guess we + // need more test on that. + return poll().expired; }; const isOwnVote = createSelector(