[DP-484] 커뮤니티 본인 답변 채택 버튼 노출 및 채택 허용 버그 수정#172
Merged
Conversation
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



Summary
AnswerWithCommentsResponse에canAdopt필드 추가 — 서버가 채택 가능 여부를 계산해서 응답GET /posts/{postId}/answers에@AuthenticationPrincipal userId추가 — 현재 유저 기준으로canAdopt판단adoptAnswer()에 본인 답변 채택 서버 측 검증 추가 — API 직접 호출 시에도 차단 (COMMUNITY_015)Root Cause
프론트에서
canAdopt조건을 직접 계산하다가 "본인 답변 여부" 체크가 누락되어, 게시글 작성자가 본인 답변에도 채택 버튼이 노출됨. 서버의adoptAnswer()도 본인 답변 채택을 막지 않았음.canAdopt 계산 조건 (서버)
currentUser == postAuthor!anyAdopted!answer.isAdoptedanswerAuthor != currentUserTest plan
AnswerServiceTest—canAdopt경계 조건 4가지 + 본인 답변 채택 예외 포함 전체 통과AnswerControllerTest—canAdopt응답 필드 검증 + 403 반환 확인./gradlew build전체 빌드 통과