Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7030305

Browse files
fix(app-server): prevent main page permanent deletion
1 parent d7a4380 commit 7030305

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

‎apps/app-server/src/trpc/api/pages/deletion/delete-permanently.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,22 @@ export async function deletePermanently({
5959
});
6060
}
6161

62+
// Check if page is main page
63+
64+
const mainPageId = await ctx.dataAbstraction.hget(
65+
'group',
66+
groupId,
67+
'main-page-id',
68+
);
69+
70+
if (input.pageId === mainPageId) {
71+
throw new TRPCError({
72+
code: 'BAD_REQUEST',
73+
message:
74+
"Cannot delete a group's main page, either replace the main page first or delete the whole group.",
75+
});
76+
}
77+
6278
// Check if page is free
6379

6480
let numFreePages;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /