fix trash in search (#1439)

- delete share if page is trashed
This commit is contained in:
Philip Okugbe
2025-08-02 00:14:00 +01:00
committed by GitHub
parent 83bc273cb0
commit 1cb2535de3
4 changed files with 28 additions and 15 deletions
@@ -43,7 +43,7 @@ export class CommentController {
@AuthWorkspace() workspace: Workspace,
) {
const page = await this.pageRepo.findById(createCommentDto.pageId);
if (!page) {
if (!page || page.deletedAt) {
throw new NotFoundException('Page not found');
}
@@ -90,7 +90,10 @@ export class CommentController {
throw new NotFoundException('Comment not found');
}
const ability = await this.spaceAbility.createForUser(user, comment.spaceId);
const ability = await this.spaceAbility.createForUser(
user,
comment.spaceId,
);
if (ability.cannot(SpaceCaslAction.Read, SpaceCaslSubject.Page)) {
throw new ForbiddenException();
}