Skip to content

Commit d4ddf2e

Browse files
committed
address two more Copilot comments
1 parent 5e5f1a9 commit d4ddf2e

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

src/components/LegalFooter/LegalFooter.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import { siteConfig } from "@/config/site";
22
import Link from "next/link";
3+
import { cookies } from "next/headers";
34
import PeelsLogo from "@/components/PeelsLogo";
45
import LocalePicker from "@/components/LocalePicker";
5-
import { createClient } from "@/utils/supabase/server";
66
import { styled } from "@pigment-css/react";
77
import { getTranslations } from "next-intl/server";
88

99
const currentYear = new Date().getFullYear();
1010

1111
export default async function LegalFooter() {
1212
const t = await getTranslations();
13-
const supabase = await createClient();
14-
const {
15-
data: { user },
16-
} = await supabase.auth.getUser();
13+
const cookieStore = await cookies();
14+
const hasSupabaseAuthCookie = cookieStore
15+
.getAll()
16+
.some(({ name }) => name.includes("auth-token"));
1717

1818
return (
1919
<StyledFooter>
@@ -22,7 +22,7 @@ export default async function LegalFooter() {
2222
© {currentYear} {siteConfig.name}
2323
</p>
2424

25-
{!user && <LocalePicker compact={true} />}
25+
{!hasSupabaseAuthCookie && <LocalePicker compact={true} />}
2626

2727
<StyledNav>
2828
<Link href={siteConfig.links.about}>{t("App.about")}</Link>

supabase/functions/send-email-for-new-chat-message/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ const handler = async (_request: Request): Promise<Response> => {
138138
const recipientEmail = recipientData?.user?.email;
139139
console.log("Recipient Email:", recipientEmail);
140140

141+
if (!recipientEmail) {
142+
throw new Error(`No email found for recipient ${recipientId}`);
143+
}
144+
141145
const { data: recipientProfile } = await supabase
142146
.from("profiles")
143147
.select("preferred_locale")

0 commit comments

Comments
 (0)