Skip to content

Commit

Permalink
[hotfix] fix: 댓글 전체를 차단된 사용자가 작성해도 노트 조회되도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
elive7 committed Nov 24, 2024
1 parent 9483f57 commit 68c0c4c
Showing 1 changed file with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,20 @@ public Optional<Note> findById(Long id, Long userId) {
.join(note.publisher).fetchJoin()
.join(note.song).fetchJoin()
.join(song.artist).fetchJoin()
.leftJoin(note.comments, comment).fetchJoin()
.leftJoin(block)
.on(block.blocked.eq(comment.writer)
.and(block.blocker.id.eq(userId))
.and(block.deletedAt.isNull()))
.leftJoin(note.comments, comment)
.on(comment.deletedAt.isNull()
.and(comment.writer.id.notIn(
JPAExpressions.select(block.blocked.id)
.from(block)
.where(
block.blocker.id.eq(userId),
block.deletedAt.isNull()
)
))
).fetchJoin()
.where(
note.id.eq(id),
note.deletedAt.isNull(),
block.id.isNull()
note.deletedAt.isNull()
)
.fetchOne()
);
Expand Down

0 comments on commit 68c0c4c

Please sign in to comment.