mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 00:03:33 +10:00
fix: add public profiles tests
This commit is contained in:
@ -60,7 +60,7 @@ export default function PublicProfilePage({ loaderData }: Route.ComponentProps)
|
||||
const { _ } = useLingui();
|
||||
const { toast } = useToast();
|
||||
|
||||
const { user } = useSession();
|
||||
const { user, refreshSession } = useSession();
|
||||
const team = useOptionalCurrentTeam();
|
||||
|
||||
const [isPublicProfileVisible, setIsPublicProfileVisible] = useState(profile.enabled);
|
||||
@ -96,6 +96,9 @@ export default function PublicProfilePage({ loaderData }: Route.ComponentProps)
|
||||
});
|
||||
} else {
|
||||
await updateUserProfile(data);
|
||||
|
||||
// Need to refresh session because we're editing the user's profile.
|
||||
await refreshSession();
|
||||
}
|
||||
|
||||
if (data.enabled === undefined && !isPublicProfileVisible) {
|
||||
|
||||
@ -7,7 +7,7 @@ import { ChevronLeft } from 'lucide-react';
|
||||
import { Link, Outlet } from 'react-router';
|
||||
|
||||
import LogoIcon from '@documenso/assets/logo_icon.png';
|
||||
import { useSession } from '@documenso/lib/client-only/providers/session';
|
||||
import { useOptionalSession } from '@documenso/lib/client-only/providers/session';
|
||||
import { cn } from '@documenso/ui/lib/utils';
|
||||
import { Button } from '@documenso/ui/primitives/button';
|
||||
|
||||
@ -21,7 +21,7 @@ export function meta() {
|
||||
}
|
||||
|
||||
export default function PublicProfileLayout() {
|
||||
const session = useSession();
|
||||
const { sessionData } = useOptionalSession();
|
||||
|
||||
const [scrollY, setScrollY] = useState(0);
|
||||
|
||||
@ -37,8 +37,8 @@ export default function PublicProfileLayout() {
|
||||
|
||||
return (
|
||||
<div className="min-h-screen">
|
||||
{session ? (
|
||||
<AuthenticatedHeader user={session.user} teams={session.teams} />
|
||||
{sessionData ? (
|
||||
<AuthenticatedHeader user={sessionData.user} teams={sessionData.teams} />
|
||||
) : (
|
||||
<header
|
||||
className={cn(
|
||||
|
||||
@ -44,7 +44,6 @@ export async function loader({ params }: Route.LoaderArgs) {
|
||||
profileUrl,
|
||||
}).catch(() => null);
|
||||
|
||||
// Todo: Test
|
||||
if (!publicProfile || !publicProfile.profile.enabled) {
|
||||
throw new Response('Not Found', { status: 404 });
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ export default function RecipientLayout() {
|
||||
);
|
||||
}
|
||||
|
||||
// Todo: Use generic error boundary.
|
||||
// Todo: (RR7) Use generic error boundary.
|
||||
export function ErrorBoundary() {
|
||||
return (
|
||||
<div className="mx-auto flex min-h-[80vh] w-full items-center justify-center py-32">
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Todo: Test, used AI to migrate this component from NextJS to Remix.
|
||||
// Todo: (RR7) Test, used AI to migrate this component from NextJS to Remix.
|
||||
import satori from 'satori';
|
||||
import sharp from 'sharp';
|
||||
import { P, match } from 'ts-pattern';
|
||||
|
||||
@ -4,7 +4,7 @@ import { NEXT_PUBLIC_MARKETING_URL, NEXT_PUBLIC_WEBAPP_URL } from '@documenso/li
|
||||
|
||||
import type { Route } from './+types/share.$slug';
|
||||
|
||||
// Todo: Test meta.
|
||||
// Todo: (RR7) Test meta.
|
||||
export function meta({ params: { slug } }: Route.MetaArgs) {
|
||||
return [
|
||||
{ title: 'Documenso - Share' },
|
||||
|
||||
@ -6,7 +6,7 @@ export type ShareHandlerAPIResponse =
|
||||
| Awaited<ReturnType<typeof getRecipientOrSenderByShareLinkSlug>>
|
||||
| { error: string };
|
||||
|
||||
// Todo: Test
|
||||
// Todo: (RR7) Test
|
||||
export async function loader({ request }: Route.LoaderArgs) {
|
||||
try {
|
||||
const url = new URL(request.url);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { stripeWebhookHandler } from '@documenso/ee/server-only/stripe/webhook/handler';
|
||||
|
||||
// Todo
|
||||
// Todo: (RR7)
|
||||
// export const config = {
|
||||
// api: { bodyParser: false },
|
||||
// };
|
||||
|
||||
@ -2,7 +2,7 @@ import { handlerTriggerWebhooks } from '@documenso/lib/server-only/webhooks/trig
|
||||
|
||||
import type { Route } from './+types/webhook.trigger';
|
||||
|
||||
// Todo
|
||||
// Todo: (RR7)
|
||||
// export const config = {
|
||||
// maxDuration: 300,
|
||||
// api: {
|
||||
|
||||
@ -6,7 +6,7 @@ import { EmbedPaywall } from '~/components/embed/embed-paywall';
|
||||
|
||||
import type { Route } from './+types/_layout';
|
||||
|
||||
// Todo: Test
|
||||
// Todo: (RR7) Test
|
||||
export function headers({ loaderHeaders }: Route.HeadersArgs) {
|
||||
const origin = loaderHeaders.get('Origin') ?? '*';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user