Skip to content

fix(be): allow admins to delete course qna comments - #3758

Merged
khgerr8909 merged 1 commit into
mainfrom
t2916-qna-admin-superadmin-delete-comment
Sep 13, 2026
Merged

fix(be): allow admins to delete course qna comments#3758
khgerr8909 merged 1 commit into
mainfrom
t2916-qna-admin-superadmin-delete-comment

Conversation

@khgerr8909

@khgerr8909 khgerr8909 commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Description

Problem

Course QnA 댓글은 기존에 댓글 작성자 본인 또는 해당 Course의 Group Leader만 삭제할 수 있도록 구현되어 있던 반면, 플랫폼 차원의 관리자인 Admin/SuperAdmin은 QnA 댓글을 삭제할 수 없는 문제가 있었습니다. (해당 문제는 Notice 댓글 삭제 권한을 추가하는 과정에서 발견하였습니다.)

따라서 기존 Notice 댓글 삭제 권한과 동일하게, QnA 댓글에서도 Admin/SuperAdmin이 다른 사용자의 댓글을 삭제할 수 있도록 권한을 추가했습니다.

Solution

기존 QnA 댓글 삭제 로직의 작성자 및 Group Leader 권한 검사는 유지하고, 사이트 Admin/SuperAdmin 권한을 추가했습니다.

다음 사용자가 QnA 댓글을 삭제할 수 있습니다.

  • 댓글 작성자 본인
  • 해당 Course의 Group Leader
  • 사이트 Admin/SuperAdmin

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

Summary by CodeRabbit

  • Bug Fixes
    • Administrators and super administrators can now delete course Q&A comments without being course leaders.
    • Existing permissions continue to allow comment authors and course staff to delete comments.

@coderabbitai

coderabbitai Bot commented Sep 12, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 99058d9d-c2dd-489e-8063-c1c90932064d

📥 Commits

Reviewing files that changed from the base of the PR and between 23f2970 and bb7f3d6.

📒 Files selected for processing (2)
  • apps/backend/apps/client/src/group/group.controller.ts
  • apps/backend/apps/client/src/group/group.service.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The 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.

Changes

Q&A comment deletion authorization

Layer / File(s) Summary
Role-aware comment deletion
apps/backend/apps/client/src/group/group.controller.ts, apps/backend/apps/client/src/group/group.service.ts
The controller passes req.user.role to deleteCourseQnAComment. The service accepts the role and allows Admin and SuperAdmin users to delete comments without course-leader membership.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to bb7f3

The role-aware deletion change is wired correctly and does not leave incompatible callers.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning Issue #123 requires a frontend progress card component for workbook progress. The component must support title, header, description, type, total, and complete values. The PR summary shows … Implement the ProgressCard component described in #123 and add relevant automated tests. Alternatively, link this PR to the issue that defines the Course QnA comment permission change.
Out of Scope Changes check ⚠️ Warning 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 #123. The change is therefore o… Remove the Course QnA permission changes from this PR, or use a direct linked issue that covers the Course QnA authorization requirement.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: allowing administrators to delete Course QnA comments.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Full details: Linked Issues check

Explanation

Issue #123 requires a frontend progress card component for workbook progress. The component must support title, header, description, type, total, and complete values. The PR summary shows only Course QnA comment permission changes in group.controller.ts and group.service.ts. No implementation or automated tests for the progress card are present in the reviewed changes.

Full details: Out of Scope Changes check

Explanation

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 #123. The change is therefore outside the linked issue scope.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch t2916-qna-admin-superadmin-delete-comment

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

apps/backend/apps/client/src/group/group.controller.ts

ESLint 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.ts

ESLint 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@lukekeum lukekeum left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@khgerr8909
khgerr8909 added this pull request to the merge queue Sep 13, 2026
@github-project-automation github-project-automation Bot moved this to Pending ✋ in Codedang Sep 13, 2026
@lukekeum lukekeum moved this from Approved 👌 to Done ✔️ in Codedang Sep 13, 2026
@github-project-automation github-project-automation Bot moved this from Pending ✋ to Approved 👌 in Codedang Sep 13, 2026
Merged via the queue into main with commit 81350ec Sep 13, 2026
33 checks passed
@khgerr8909
khgerr8909 deleted the t2916-qna-admin-superadmin-delete-comment branch September 13, 2026 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done ✔️

Development

Successfully merging this pull request may close these issues.

2 participants