fix: rename default to home board (#1538)
This commit is contained in:
@@ -229,10 +229,10 @@ export const boardRouter = createTRPCRouter({
|
||||
await throwIfActionForbiddenAsync(ctx, eq(boards.id, input.id), "full");
|
||||
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({
|
||||
code: "BAD_REQUEST",
|
||||
message: "Cannot make default board private",
|
||||
message: "Cannot make home board private",
|
||||
});
|
||||
}
|
||||
|
||||
@@ -259,13 +259,13 @@ export const boardRouter = createTRPCRouter({
|
||||
})
|
||||
: 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;
|
||||
if (user?.homeBoardId) {
|
||||
boardWhere = eq(boards.id, user.homeBoardId);
|
||||
} else {
|
||||
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) {
|
||||
|
||||
@@ -507,7 +507,7 @@ describe("getHomeBoard should return home board", () => {
|
||||
const fullBoardProps = await createFullBoardAsync(db, "home");
|
||||
await db.insert(serverSettings).values({
|
||||
settingKey: "board",
|
||||
value: SuperJSON.stringify({ defaultBoardId: fullBoardProps.boardId }),
|
||||
value: SuperJSON.stringify({ homeBoardId: fullBoardProps.boardId }),
|
||||
});
|
||||
|
||||
// Act
|
||||
|
||||
@@ -25,7 +25,7 @@ export const defaultServerSettings = {
|
||||
noSiteLinksSearchBox: false,
|
||||
},
|
||||
board: {
|
||||
defaultBoardId: null as string | null,
|
||||
homeBoardId: null as string | null,
|
||||
},
|
||||
appearance: {
|
||||
defaultColorScheme: "light" as ColorScheme,
|
||||
|
||||
@@ -2075,8 +2075,8 @@
|
||||
},
|
||||
"board": {
|
||||
"title": "Boards",
|
||||
"defaultBoard": {
|
||||
"label": "Global default board",
|
||||
"homeBoard": {
|
||||
"label": "Global home board",
|
||||
"description": "Only public boards are available for selection"
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user