Fix patreon not sharing between guild members

This commit is contained in:
jude 2024-08-19 21:45:24 +01:00
parent 96dc80fef9
commit e7c840a4d4
2 changed files with 11 additions and 4 deletions

View File

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

View File

@ -74,7 +74,7 @@ pub async fn get_user_info(
let preferences = sqlx::query!(
"
SELECT
timezone,
IFNULL(timezone, 'UTC') AS timezone,
use_browser_timezone,
dashboard_color_scheme,
reset_inputs_on_create