Skip to content

Commit 04a0ee3

Browse files
committed
Fix billing alerts scope
1 parent 6f9f1d5 commit 04a0ee3

File tree

1 file changed

+3
-3
lines changed
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.settings.billing-alerts

1 file changed

+3
-3
lines changed

apps/webapp/app/routes/_app.orgs.$organizationSlug.settings.billing-alerts/route.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,16 @@ export const meta: MetaFunction = () => {
4747
};
4848

4949
export async function loader({ params, request }: LoaderFunctionArgs) {
50-
await requireUserId(request);
50+
const userId = await requireUserId(request);
5151
const { organizationSlug } = OrganizationParamsSchema.parse(params);
5252

5353
const { isManagedCloud } = featuresForRequest(request);
5454
if (!isManagedCloud) {
5555
return redirect(organizationPath({ slug: organizationSlug }));
5656
}
5757

58-
const organization = await prisma.organization.findUnique({
59-
where: { slug: organizationSlug },
58+
const organization = await prisma.organization.findFirst({
59+
where: { slug: organizationSlug, members: { some: { userId } } },
6060
});
6161

6262
if (!organization) {

0 commit comments

Comments
 (0)