fix: rename default to home board (#1538)

This commit is contained in:
Meier Lukas
2024-11-24 13:44:43 +01:00
committed by GitHub
parent ecf299e03b
commit 1c4d4f4e9d
6 changed files with 12 additions and 12 deletions

View File

@@ -95,7 +95,7 @@ export default async function BoardSettingsPage({ params, searchParams }: Props)
<BoardAccessSettings board={board} initialPermissions={permissions} /> <BoardAccessSettings board={board} initialPermissions={permissions} />
</AccordionItemFor> </AccordionItemFor>
<AccordionItemFor value="dangerZone" icon={IconAlertTriangle} danger noPadding> <AccordionItemFor value="dangerZone" icon={IconAlertTriangle} danger noPadding>
<DangerZoneSettingsContent hideVisibility={boardSettings.defaultBoardId === board.id} /> <DangerZoneSettingsContent hideVisibility={boardSettings.homeBoardId === board.id} />
</AccordionItemFor> </AccordionItemFor>
</> </>
)} )}

View File

@@ -19,8 +19,8 @@ export const BoardSettingsForm = ({ defaultValues }: { defaultValues: ServerSett
{(form) => ( {(form) => (
<> <>
<SelectWithCustomItems <SelectWithCustomItems
label={tBoard("defaultBoard.label")} label={tBoard("homeBoard.label")}
description={tBoard("defaultBoard.description")} description={tBoard("homeBoard.description")}
data={selectableBoards.map((board) => ({ data={selectableBoards.map((board) => ({
value: board.id, value: board.id,
label: board.name, label: board.name,
@@ -35,7 +35,7 @@ export const BoardSettingsForm = ({ defaultValues }: { defaultValues: ServerSett
</Text> </Text>
</Group> </Group>
)} )}
{...form.getInputProps("defaultBoardId")} {...form.getInputProps("homeBoardId")}
/> />
</> </>
)} )}

View File

@@ -229,10 +229,10 @@ export const boardRouter = createTRPCRouter({
await throwIfActionForbiddenAsync(ctx, eq(boards.id, input.id), "full"); await throwIfActionForbiddenAsync(ctx, eq(boards.id, input.id), "full");
const boardSettings = await getServerSettingByKeyAsync(ctx.db, "board"); const boardSettings = await getServerSettingByKeyAsync(ctx.db, "board");
if (input.visibility !== "public" && boardSettings.defaultBoardId === input.id) { if (input.visibility !== "public" && boardSettings.homeBoardId === input.id) {
throw new TRPCError({ throw new TRPCError({
code: "BAD_REQUEST", code: "BAD_REQUEST",
message: "Cannot make default board private", message: "Cannot make home board private",
}); });
} }
@@ -259,13 +259,13 @@ export const boardRouter = createTRPCRouter({
}) })
: null; : null;
// 1. user home board, 2. default board, 3. not found // 1. user home board, 2. home board, 3. not found
let boardWhere: SQL<unknown> | null = null; let boardWhere: SQL<unknown> | null = null;
if (user?.homeBoardId) { if (user?.homeBoardId) {
boardWhere = eq(boards.id, user.homeBoardId); boardWhere = eq(boards.id, user.homeBoardId);
} else { } else {
const boardSettings = await getServerSettingByKeyAsync(ctx.db, "board"); const boardSettings = await getServerSettingByKeyAsync(ctx.db, "board");
boardWhere = boardSettings.defaultBoardId ? eq(boards.id, boardSettings.defaultBoardId) : null; boardWhere = boardSettings.homeBoardId ? eq(boards.id, boardSettings.homeBoardId) : null;
} }
if (!boardWhere) { if (!boardWhere) {

View File

@@ -507,7 +507,7 @@ describe("getHomeBoard should return home board", () => {
const fullBoardProps = await createFullBoardAsync(db, "home"); const fullBoardProps = await createFullBoardAsync(db, "home");
await db.insert(serverSettings).values({ await db.insert(serverSettings).values({
settingKey: "board", settingKey: "board",
value: SuperJSON.stringify({ defaultBoardId: fullBoardProps.boardId }), value: SuperJSON.stringify({ homeBoardId: fullBoardProps.boardId }),
}); });
// Act // Act

View File

@@ -25,7 +25,7 @@ export const defaultServerSettings = {
noSiteLinksSearchBox: false, noSiteLinksSearchBox: false,
}, },
board: { board: {
defaultBoardId: null as string | null, homeBoardId: null as string | null,
}, },
appearance: { appearance: {
defaultColorScheme: "light" as ColorScheme, defaultColorScheme: "light" as ColorScheme,

View File

@@ -2075,8 +2075,8 @@
}, },
"board": { "board": {
"title": "Boards", "title": "Boards",
"defaultBoard": { "homeBoard": {
"label": "Global default board", "label": "Global home board",
"description": "Only public boards are available for selection" "description": "Only public boards are available for selection"
} }
}, },