[FEAT] 투표·댓글 신고 기능 연동 - #154
Conversation
서버에 구현되어 있던 신고 API(POST /report/{targetId})를 웹에 연동한다.
- api/report.ts: createReport + ReportType/ReportReason 타입, 사유 9종 라벨(서버 enum과 1:1)
- reportSheet: 사유 선택 + 상세 내용(선택, 1000자) 바텀시트
- useReportAction: 로그인 게이트 → 시트 → 제출 → 결과 팝업 공용 훅
- moreMenu: 케밥 드롭다운 공용화 (commentDetail 인라인 메뉴 대체)
- 진입점: 투표 상세 헤더 ⋮, 댓글·대댓글 ⋮
- 본인 글/댓글은 메뉴에서 제외 (서버도 400으로 거부)
- 삭제된 댓글은 제외 (서버 응답 기준 deletedAt)
- 비로그인은 메뉴 노출 후 클릭 시 로그인 유도
- sheet 프리미티브 타이포를 typo-* 토큰으로 교체 (AGENTS.md §8)
영향받는 문서: SCR-POLL-001
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
관리자가 신고를 처리하기 전까지, 신고한 사용자에게만 해당 콘텐츠를 가린다. 서버에 "내가 이 대상을 신고했는지" 알려주는 필드·API 가 없어서 신고한 대상 id 를 localStorage 에 보관하고 그것을 기준으로 가린다. 서버가 reportedByMe 같은 값을 내려주면 저장소만 교체하면 된다. - utils/reportedContent: 신고 대상 id 로컬 저장 + 구독. 다른 탭 storage 이벤트 반영, JSON 파손·저장 실패 방어 - useReportedContent: useSyncExternalStore 구독 훅. 서버 스냅샷을 비워 hydration 불일치 방지 - useReportAction: 신고 성공 시 markReported 기록 - commentDetail: 신고한 댓글·대댓글은 작성자·본문·좋아요·⋮ 를 모두 감추고 "신고한 콘텐츠입니다" 만 노출 (원문 보기 토글 없음) - mainPage·balansePage: 신고한 투표는 목록에서 제외, 비면 기존 EmptyState 한계: 기기·브라우저 단위라 다른 기기에서는 다시 보인다. 영향받는 문서: SCR-POLL-001, SCR-HOME-001, SCR-BALANSE-001 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
서버에는 신고 API가 이미 구현되어 있었으나 웹에 연동되어 있지 않았습니다. (#84 의 미체크 항목 "신고 기능")
✅ 작업 내용
사용자 신고(Phase 1)만 포함합니다. CMS 관리자 신고 처리 화면은 후속 PR 예정.
api/report.ts—createReport()+ReportType/ReportReason타입, 사유 9종 라벨(서버ReportReasonenum과 1:1), 상세 내용 1,000자 상수ui/modal/reportSheet.tsx— 신고 사유 선택 + 상세 내용(선택) 바텀시트hooks/utils/useReportAction.tsx— 로그인 게이트 → 시트 → 제출 → 결과 팝업 공용 훅_shared/moreMenu.tsx— 케밥(⋮) 드롭다운 공용화. commentDetail 에 인라인으로 있던 메뉴를 대체⋮, 댓글·대댓글⋮ui/sheet.tsx— shadcn 기본 타이포(text-lg font-semibold,text-sm)를typo-*토큰으로 교체 (AGENTS.md §8)사용 API
/report/{targetId}{ reportType, reason, content? }· 로그인 필요메뉴 노출 규칙
deletedAt)이미 신고한 대상입니다.메시지를 그대로 팝업 노출🧪 검증
dev 서버 + dev 백엔드, 375×812 기준으로 확인:
⋮→ 신고 진입, 비로그인 시 로그인 유도 팝업tsc --noEmit,eslint,prettier --check통과미검증: 로그인이 필요한 실제 POST 성공·중복 신고 팝업 경로 (리뷰 시 확인 부탁드립니다)
📝 영향받는 SCR-ID
SCR-POLL-001— 레이아웃·사용자 액션·시나리오·예외 상황·사용 API 갱신🔎 참고
Comment/Reply인터페이스의deleted: boolean필드는 서버가 내려주지 않아 항상undefined입니다. 이번 PR에서는 손대지 않고deletedAt을 사용했습니다.🤖 Generated with Claude Code