Fix patreon not sharing between guild members

This commit is contained in:
jude 2024-08-19 21:45:24 +01:00
parent d7e90614c8
commit 748e33566b

View File

@ -1,8 +1,7 @@
import { ChannelSelector } from "./ChannelSelector"; import { ChannelSelector } from "./ChannelSelector";
import { DateTime } from "luxon";
import { IntervalSelector } from "./IntervalSelector"; import { IntervalSelector } from "./IntervalSelector";
import { useQuery } from "react-query"; import { useQuery } from "react-query";
import { fetchUserInfo } from "../../api"; import { fetchGuildInfo, fetchUserInfo } from "../../api";
import { useReminder } from "./ReminderContext"; import { useReminder } from "./ReminderContext";
import { Attachment } from "./Attachment"; import { Attachment } from "./Attachment";
import { TTS } from "./TTS"; import { TTS } from "./TTS";
@ -11,11 +10,12 @@ import { useGuild } from "../App/useGuild";
export const Settings = () => { export const Settings = () => {
const guild = useGuild(); const guild = useGuild();
const { isSuccess: userFetched, data: userInfo } = useQuery(fetchUserInfo()); const { isSuccess: userFetched, data: userInfo } = useQuery({ ...fetchUserInfo() });
const { isSuccess: guildFetched, data: guildInfo } = useQuery({ ...fetchGuildInfo(guild) });
const [reminder, setReminder] = useReminder(); const [reminder, setReminder] = useReminder();
if (!userFetched) { if (!userFetched || !guildFetched) {
return <></>; return <></>;
} }
@ -59,7 +59,13 @@ export const Settings = () => {
<div class="collapses split-controls"> <div class="collapses split-controls">
<div> <div>
<div class={userInfo.patreon ? "patreon-only" : "patreon-only is-locked"}> <div
class={
userInfo.patreon || guildInfo.patreon
? "patreon-only"
: "patreon-only is-locked"
}
>
<div class="patreon-invert foreground"> <div class="patreon-invert foreground">
Intervals available on <a href="https://patreon.com/jellywx">Patreon</a>{" "} Intervals available on <a href="https://patreon.com/jellywx">Patreon</a>{" "}
or{" "} or{" "}