fix #57: allow users vote even if they voted
All checks were successful
/ depoly (push) Successful in 1m24s
All checks were successful
/ depoly (push) Successful in 1m24s
This commit is contained in:
parent
b2db680076
commit
b6fbe71a51
1 changed files with 12 additions and 7 deletions
|
@ -9,7 +9,7 @@ import {
|
||||||
} from "solid-js";
|
} from "solid-js";
|
||||||
import "./TootPoll.css";
|
import "./TootPoll.css";
|
||||||
import type { mastodon } from "masto";
|
import type { mastodon } from "masto";
|
||||||
import { resolveCustomEmoji } from "../../masto/toot";
|
import { resolveCustomEmoji } from "../../masto/toot.js";
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Checkbox,
|
Checkbox,
|
||||||
|
@ -20,11 +20,11 @@ import {
|
||||||
Radio,
|
Radio,
|
||||||
} from "@suid/material";
|
} from "@suid/material";
|
||||||
import { formatDistance, isBefore } from "date-fns";
|
import { formatDistance, isBefore } from "date-fns";
|
||||||
import { useTimeSource } from "~platform/timesrc";
|
import { useTimeSource } from "~platform/timesrc.js";
|
||||||
import { useDateFnLocale } from "~platform/i18n";
|
import { useDateFnLocale } from "~platform/i18n.js";
|
||||||
import TootPollDialog from "./TootPollDialog";
|
import TootPollDialog from "./TootPollDialog.js";
|
||||||
import { ANIM_CURVE_STD } from "~material/theme";
|
import { ANIM_CURVE_STD } from "~material/theme.js";
|
||||||
import { useTootEnv } from "../RegularToot";
|
import { useTootEnv } from "../RegularToot.js";
|
||||||
|
|
||||||
type TootPollProps = {
|
type TootPollProps = {
|
||||||
value: mastodon.v1.Poll;
|
value: mastodon.v1.Poll;
|
||||||
|
@ -50,7 +50,12 @@ const TootPoll: Component<TootPollProps> = (props) => {
|
||||||
return n;
|
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(
|
const isOwnVote = createSelector(
|
||||||
|
|
Loading…
Add table
Reference in a new issue