-
Notifications
You must be signed in to change notification settings - Fork 1
[feat] 사용자 차단 기능 구현 (앱스토어 UGC 심사 대응) (#377) #378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d1c4df0
[feat] 사용자 차단/차단 해제 API 및 차단 목록 조회 추가 (#377)
15f4faf
[feat] 차단 사용자 콘텐츠를 피드/댓글/검색/팔로우 목록에서 숨김 (#377)
47f5a6a
[feat] 차단 사용자 콘텐츠를 모임방/기록/투표/오늘의 한마디에서 숨김 (#377)
24ce986
[feat] 차단 관계에서 알림 생성 및 상호작용 차단 (#377)
be30420
[fix] user_blocks 엔티티의 인덱스 선언 제거 (#377)
193520c
[test] 차단 목록 조회의 커서 페이징 검증 추가 (#377)
d6a0ba1
[chore] 테스트 실패 시 CI 로그에 전체 스택을 출력 (#377)
67252ef
[fix] 테스트 프로필에 MySQL 전용 커넥션 초기화 SQL 이 상속되지 않도록 차단 (#377)
81571dc
[fix] 테스트 타임존을 KST 로 고정해 커서 페이징 테스트 실패 해결 (#377)
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,13 +10,16 @@ | |
| import konkuk.thip.comment.application.port.out.dto.CommentQueryDto; | ||
| import konkuk.thip.comment.application.service.validator.CommentAuthorizationValidator; | ||
| import konkuk.thip.comment.domain.Comment; | ||
| import konkuk.thip.common.exception.BusinessException; | ||
| import konkuk.thip.common.exception.code.ErrorCode; | ||
| import konkuk.thip.common.exception.InvalidStateException; | ||
| import konkuk.thip.notification.application.port.in.FeedNotificationOrchestrator; | ||
| import konkuk.thip.notification.application.port.in.RoomNotificationOrchestrator; | ||
| import konkuk.thip.post.application.port.out.dto.PostQueryDto; | ||
| import konkuk.thip.post.domain.CountUpdatable; | ||
| import konkuk.thip.post.application.service.handler.PostHandler; | ||
| import konkuk.thip.post.domain.PostType; | ||
| import konkuk.thip.user.application.port.out.UserBlockQueryPort; | ||
| import konkuk.thip.user.application.port.out.UserCommandPort; | ||
| import konkuk.thip.user.domain.User; | ||
| import lombok.RequiredArgsConstructor; | ||
|
|
@@ -35,6 +38,7 @@ public class CommentCreateService implements CommentCreateUseCase { | |
| private final CommentLikeQueryPort commentLikeQueryPort; | ||
| private final CommentQueryMapper commentQueryMapper; | ||
| private final UserCommandPort userCommandPort; | ||
| private final UserBlockQueryPort userBlockQueryPort; | ||
|
|
||
| private final PostHandler postHandler; | ||
| private final CommentAuthorizationValidator commentAuthorizationValidator; | ||
|
|
@@ -55,8 +59,11 @@ public CommentCreateResponse createComment(CommentCreateCommand command) { | |
| // 2-1. 게시글 타입에 따른 댓글 생성 권한 검증 | ||
| commentAuthorizationValidator.validateUserCanAccessPostForComment(type, post, command.userId()); | ||
|
|
||
| // 2-2. 댓글 생성 푸쉬 알림 전송 (게시글 작성자에게) | ||
| // 2-2. 차단 관계인 작성자의 게시글에는 댓글을 달 수 없다 | ||
| PostQueryDto postQueryDto = postHandler.getPostQueryDto(type, post.getId()); | ||
| validateNotBlocked(command.userId(), postQueryDto.creatorId()); | ||
|
Comment on lines
+62
to
+64
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win 답글 작성 전에 부모 댓글 작성자와의 차단 관계도 검사해야 합니다. Line 64는 게시글 작성자만 검사합니다. 답글의 부모 댓글 작성자가 게시글 작성자와 다르면, 차단 관계여도 답글이 저장됩니다. 부모 댓글을 생성 전에 조회하고 🤖 Prompt for AI Agents |
||
|
|
||
| // 2-3. 댓글 생성 푸쉬 알림 전송 (게시글 작성자에게) | ||
| User actorUser = userCommandPort.findById(command.userId()); | ||
| sendNotificationsToPostWriter(postQueryDto, actorUser); | ||
|
|
||
|
|
@@ -90,6 +97,15 @@ public CommentCreateResponse createComment(CommentCreateCommand command) { | |
| } | ||
| } | ||
|
|
||
| private void validateNotBlocked(Long userId, Long targetUserId) { | ||
| if (targetUserId == null || userId.equals(targetUserId)) { | ||
| return; | ||
| } | ||
| if (userBlockQueryPort.existsBlockBetween(userId, targetUserId)) { | ||
| throw new BusinessException(ErrorCode.USER_BLOCKED_CANNOT_INTERACT); | ||
| } | ||
| } | ||
|
|
||
| private void sendNotificationsToPostWriter(PostQueryDto postQueryDto, User actorUser) { | ||
| if (postQueryDto.creatorId().equals(actorUser.getId())) return; // 자신이 작성한 게시글 제외 | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
차단 필터를 전체 방 개수에도 적용하세요.
Line 27은
userId없이 전체 방 개수를 계산합니다. Line 30은userId를 사용하여 차단된 방장을 제외합니다. 따라서 첫 페이지 응답의totalRoomCount에는 사용자가 조회할 수 없는 방이 포함됩니다.countRecruitingRoomsByBookIsbn에도viewerId를 전달하고, 목록 조회와 동일한 차단 조건을 적용하세요.🤖 Prompt for AI Agents