Skip to content

Commit 812a129

Browse files
authored
Merge pull request #124 from team-gogo/fix/stage-community-board-error
[community] 커뮤니티 게시글 좋아요, 불러오기 문제
2 parents 200e771 + 68b26d8 commit 812a129

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

src/main/kotlin/gogo/gogostage/domain/community/root/application/CommunityServiceImpl.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class CommunityServiceImpl(
4545
val student = userUtil.getCurrentStudent()
4646
val board = boardReader.read(boardId)
4747
stageValidator.validStage(student, board.community.stage.id)
48+
stageValidator.validProfanityFilter(student, board)
4849
val isActiveProfanityFilter = student.isActiveProfanityFilter
4950
return communityReader.readBoardInfo(isActiveProfanityFilter, board, student)
5051
}

src/main/kotlin/gogo/gogostage/domain/community/root/persistence/CommunityCustomRepositoryImpl.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ class CommunityCustomRepositoryImpl(
3434
predicate.and(community.category.eq(it))
3535
}
3636

37-
predicate.and(board.isFiltered.eq(isActiveProfanityFilter))
37+
if (isActiveProfanityFilter) {
38+
predicate.and(board.isFiltered.eq(false))
39+
}
3840

3941
val boards = queryFactory
4042
.selectFrom(board)
@@ -110,11 +112,13 @@ class CommunityCustomRepositoryImpl(
110112

111113
val boardAuthorDto = AuthorDto(boardAuthor.studentId, boardAuthor.name, boardAuthor.classNumber, boardAuthor.studentNumber)
112114

113-
val isAuthorBoardLike = boardLikeRepository.existsByStudentIdAndBoardId(boardAuthorDto.studentId, board.id)
115+
val isAuthorBoardLike = boardLikeRepository.existsByStudentIdAndBoardId(student.studentId, board.id)
114116

115117
val predicate = BooleanBuilder()
116118

117-
predicate.and(comment.isFiltered.eq(isActiveProfanityFilter))
119+
if (isActiveProfanityFilter) {
120+
predicate.and(comment.isFiltered.eq(false))
121+
}
118122

119123
predicate.and(comment.board.id.eq(board.id))
120124

src/main/kotlin/gogo/gogostage/domain/stage/root/application/StageValidator.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package gogo.gogostage.domain.stage.root.application
22

3+
import gogo.gogostage.domain.community.board.persistence.Board
34
import gogo.gogostage.domain.game.persistence.GameRepository
45
import gogo.gogostage.domain.stage.participant.root.persistence.StageParticipantRepository
56
import gogo.gogostage.domain.stage.root.application.dto.CreateFastStageDto
@@ -85,6 +86,12 @@ class StageValidator(
8586
}
8687
}
8788

89+
fun validProfanityFilter(student: StudentByIdStub, board: Board) {
90+
if (board.isFiltered && student.isActiveProfanityFilter) {
91+
throw StageException("해당 게시글은 욕설 필터가 켜져있어 볼 수 없습니다.", HttpStatus.BAD_REQUEST.value())
92+
}
93+
}
94+
8895
private fun validShop(dto: CreateOfficialStageDto) {
8996
if (dto.shop.coinToss.isActive && (dto.shop.coinToss.price == null || dto.shop.coinToss.quantity == null)) {
9097
throw StageException("CoinToss 미니게임의 티켓 가격, 수량을 입력하세요.", HttpStatus.BAD_REQUEST.value())

0 commit comments

Comments
 (0)