feat: implemented submission review system - #19
Merged
Conversation
|
@R3Nexe is attempting to deploy a commit to the Sky Ruler's projects Team on Vercel. A member of the Team first needs to authorize it. |
R3Nexe
referenced
this pull request
in R3Nexe/Algorithm-Arena-V2
Jun 12, 2026
feat: implemented submission review system
sky-ruler
pushed a commit
that referenced
this pull request
Aug 4, 2026
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.
Overview
This PR implements a full‑cycle admin/clan‑chief review system for user code submissions, making the workflow accessible to admins, super‑admins, and clan‑chiefs. It adds review metadata, UI enhancements, and the ability for reviewers to provide feedback and for users to see that feedback and retry challenges.
Backend Changes
server/models/Submission.jsreviewComment(String),reviewedBy(ObjectId → User),reviewedAt(Date) fields to store reviewer feedback and audit data.server/validators/submissionSchemas.jssubmissionUpdateSchema→reviewCommentnow requires a minimum length of 1 (.min(1, { message: 'Comment cannot be empty' })), preventing empty comments on rejection.server/controllers/SubmissionController.jsgetSubmissionByIdnow populatesreviewedBy(username & role).•
updateSubmissionStatuspersistsstatus,reviewComment,reviewedBy, andreviewedAt; validates reviewer role via existingchiefOrAdminmiddleware.server/routes/submissionRoutes.jschiefOrAdminmiddleware already allowsadmin,super-admin, andclan-chief.Result: The API can now record who reviewed a submission, when, and any rejection comments.
Front‑end – Admin / Clan‑Chief Review Flow
client/src/pages/AdminPanel.jsxLink. Challenge titles in the Review Work tab are now clickable<Link>s that navigate to/challenge/:challengeId?review=:submissionId.client/src/pages/ClanChiefPanel.jsxclient/src/pages/ChallengeDetails.jsxuseSearchParams&useAuthto detect review mode (?review=) and verify reviewer role.• When in review mode:
- Fetches the submission, pre‑loads its code, makes the editor read‑only.
- Shows a “Review Mode” badge.
- Replaces the normal submit panel with a review panel (accept / reject buttons, optional comment textarea).
- Handles grading via
PUT /api/submissions/:idincludingreviewCommentwhen rejecting.client/src/pages/Dashboard.jsxFiMessageSquareimport and a “Feedback” badge next to the status for rejected submissions that contain a review comment, making it obvious in Recent Activity that feedback exists.Result: Reviewers can click a submission, view the submitted code in a read‑only editor, and accept or reject it with optional feedback—all from the same UI used for solving challenges.
Front‑end – User Feedback View
client/src/pages/SubmissionDetails.jsx• Left panel – read‑only CodeMirror showing the submitted code.
• Right panel – reviewer feedback card (if rejected with comment), status‑specific cards, challenge info, and a “Retry Challenge” button for rejected submissions.
client/src/pages/SubmissionDetails.jsx(new components)StatusBadge, color‑coded status display, and a reviewer info block.client/src/pages/SubmissionDetails.jsx(styles)Result: Users can instantly see reviewer comments, understand the submission status, and retry the challenge directly from the details page.
How to Test
SubmissionDetails.