fix(be): allow admins to delete course qna comments - #3758
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe Q&A comment deletion endpoint now passes the authenticated user's site role. The service treats Admin and SuperAdmin users as course staff during authorization. ChangesQ&A comment deletion authorization
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~8 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The role-aware deletion change is wired correctly and does not leave incompatible callers. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Linked Issues checkExplanation Issue Full details: Out of Scope Changes checkExplanation The PR changes Course QnA comment deletion authorization for Admin and SuperAdmin users. This change has no connection to the directly linked progress card objective in
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Some tools did not complete. Review the errors below. 🔧 ESLint
apps/backend/apps/client/src/group/group.controller.tsESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox. apps/backend/apps/client/src/group/group.service.tsESLint skipped: the matched ESLint configuration already failed (missing-dependency). 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 |
Description
Problem
Course QnA 댓글은 기존에 댓글 작성자 본인 또는 해당 Course의 Group Leader만 삭제할 수 있도록 구현되어 있던 반면, 플랫폼 차원의 관리자인 Admin/SuperAdmin은 QnA 댓글을 삭제할 수 없는 문제가 있었습니다. (해당 문제는 Notice 댓글 삭제 권한을 추가하는 과정에서 발견하였습니다.)
따라서 기존 Notice 댓글 삭제 권한과 동일하게, QnA 댓글에서도 Admin/SuperAdmin이 다른 사용자의 댓글을 삭제할 수 있도록 권한을 추가했습니다.
Solution
기존 QnA 댓글 삭제 로직의 작성자 및 Group Leader 권한 검사는 유지하고, 사이트 Admin/SuperAdmin 권한을 추가했습니다.
다음 사용자가 QnA 댓글을 삭제할 수 있습니다.
Controller에서 현재 사용자의
role을 Service로 전달하고, Service에서Role.Admin또는Role.SuperAdmin인지 확인하도록 수정했습니다.기존 댓글 삭제 및 QnA의
isResolved갱신 로직은 변경하지 않았습니다.Additional context
기존 Course Notice 댓글 삭제 로직의 Admin/SuperAdmin 권한 확인 방식을 참고했습니다.
리뷰 시 기존 댓글 작성자 및 Group Leader의 삭제 권한이 유지되는지와 Admin/SuperAdmin이 다른 사용자의 QnA 댓글을 삭제할 수 있는지 확인 부탁드립니다.
tsc --noEmit타입 체크, Prettier, ESLint를 통과했습니다.Closes TAS-2916
Before submitting the PR, please make sure you do the following
fixes #123).Summary by CodeRabbit