Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

fix reports permissions, long team overflow, language settings

Francis Caod87ae84a2946
diff --git a/src/app/(main)/settings/SettingsLayout.tsx b/src/app/(main)/settings/SettingsLayout.tsx
index 5af26fa5a..787d6c64c 100644
--- a/src/app/(main)/settings/SettingsLayout.tsx
+++ b/src/app/(main)/settings/SettingsLayout.tsx
@@ -1,10 +1,10 @@
'use client';
-import { ReactNode } from 'react';
-import { Grid, Column } from '@umami/react-zen';
-import { useMessages, useNavigation } from '@/components/hooks';
import { PageBody } from '@/components/common/PageBody';
import { SideMenu } from '@/components/common/SideMenu';
-import { UserCircle, Users, Settings2 } from '@/components/icons';
+import { useMessages, useNavigation } from '@/components/hooks';
+import { Settings2, UserCircle, Users } from '@/components/icons';
+import { Column, Grid } from '@umami/react-zen';
+import { ReactNode } from 'react';
export function SettingsLayout({ children }: { children: ReactNode }) {
const { formatMessage, labels } = useMessages();
@@ -46,8 +46,15 @@ export function SettingsLayout({ children }: { children: ReactNode }) {
.find(({ path }) => path && pathname.includes(path.split('?')[0]))?.id;
return (
- <Grid columns="auto 1fr" width="100%" height="100%">
- <Column height="100%" border="right" backgroundColor>
+ <Grid columns={{ xs: '1fr', lg: 'auto 1fr' }} width="100%" height="100%">
+ <Column
+ display={{ xs: 'none', lg: 'flex' }}
+ width="240px"
+ height="100%"
+ border="right"
+ backgroundColor
+ marginRight="2"
+ >
<SideMenu
items={items}
title={formatMessage(labels.settings)}
diff --git a/src/app/api/reports/[reportId]/route.ts b/src/app/api/reports/[reportId]/route.ts
index 931ed6ee1..1f22c62fe 100644
--- a/src/app/api/reports/[reportId]/route.ts
+++ b/src/app/api/reports/[reportId]/route.ts
@@ -1,8 +1,8 @@
import { parseRequest } from '@/lib/request';
-import { deleteReport, getReport, updateReport } from '@/queries/prisma';
-import { canDeleteReport, canUpdateReport, canViewReport } from '@/permissions';
-import { unauthorized, json, notFound, ok } from '@/lib/response';
+import { json, notFound, ok, unauthorized } from '@/lib/response';
import { reportSchema } from '@/lib/schema';
+import { canDeleteWebsite, canUpdateWebsite, canViewReport } from '@/permissions';
+import { deleteReport, getReport, updateReport } from '@/queries/prisma';
export async function GET(request: Request, { params }: { params: Promise<{ reportId: string }> }) {
const { auth, error } = await parseRequest(request);
@@ -41,7 +41,7 @@ export async function POST(
return notFound();
}
- if (!(await canUpdateReport(auth, report))) {
+ if (!(await canUpdateWebsite(auth, websiteId))) {
return unauthorized();
}
@@ -70,7 +70,7 @@ export async function DELETE(
const { reportId } = await params;
const report = await getReport(reportId);
- if (!(await canDeleteReport(auth, report))) {
+ if (!(await canDeleteWebsite(auth, report.websiteId))) {
return unauthorized();
}
diff --git a/src/components/hooks/useLocale.ts b/src/components/hooks/useLocale.ts
index 8d96fdde9..9dd164e59 100644
--- a/src/components/hooks/useLocale.ts
+++ b/src/components/hooks/useLocale.ts
@@ -26,7 +26,7 @@ export function useLocale() {
}
async function saveLocale(value: string) {
- if (!messages[value]) {
+ if (!messages[value] && !process.env.cloudMode) {
await loadMessages(value);
}
diff --git a/src/components/input/NavButton.tsx b/src/components/input/NavButton.tsx
index e1f7129d7..b57c2ecdc 100644
--- a/src/components/input/NavButton.tsx
+++ b/src/components/input/NavButton.tsx
@@ -69,7 +69,7 @@ export function NavButton({ showText = true }: TeamsButtonProps) {
shadow="1"
maxHeight="40px"
role="button"
- style={{ cursor: 'pointer', textWrap: 'nowrap', outline: 'none' }}
+ style={{ cursor: 'pointer', textWrap: 'nowrap', overflow: 'hidden', outline: 'none' }}
>
<Row alignItems="center" position="relative" gap maxHeight="40px">
<Icon>{teamId ? <Users /> : <User />}</Icon>