diff --git a/src/main/kotlin/com/example/onui/domain/timeline/service/TimelineServiceImpl.kt b/src/main/kotlin/com/example/onui/domain/timeline/service/TimelineServiceImpl.kt index 78a4f96..c1711de 100644 --- a/src/main/kotlin/com/example/onui/domain/timeline/service/TimelineServiceImpl.kt +++ b/src/main/kotlin/com/example/onui/domain/timeline/service/TimelineServiceImpl.kt @@ -58,9 +58,13 @@ class TimelineServiceImpl( @Transactional override fun comment(timelineId: UUID, comment: String): CommentResponse { + val user = userFacade.getCurrentUser() + val timeline = diaryRepository.findByIdAndIsPosted(timelineId, true) ?: throw TimelineNotFoundException - return commentRepository.save(Comment(comment, userFacade.getCurrentUser(), timeline)).toResponse() + val commented = commentRepository.save(Comment(comment, userFacade.getCurrentUser(), timeline)) + + return if (user.onFiltering) commented.toFilteringResponse(badWordFiltering) else commented.toResponse() } override fun getComment(timelineId: UUID): CommentListResponse {