core: check perm for solution voting (#1089)

This commit is contained in:
Hao Liu authored and GitHub committed 2025-11-18 04:07:51 +00:00
1 parent 6bed7e4cac
commit effc7da312
1 file changed
+2
+2
View File
@@ -922,12 +922,14 @@ export class ProblemSolutionHandler extends ProblemDetailHandler {
@param('psid', Types.ObjectId)
async postUpvote(domainId: string, psid: ObjectId) {
this.checkPerm(PERM.PERM_VOTE_PROBLEM_SOLUTION);
const psdoc = await solution.vote(domainId, psid, this.user._id, 1);
this.back({ vote: psdoc.vote, user_vote: 1 });
}
@param('psid', Types.ObjectId)
async postDownvote(domainId: string, psid: ObjectId) {
this.checkPerm(PERM.PERM_VOTE_PROBLEM_SOLUTION);
const psdoc = await solution.vote(domainId, psid, this.user._id, -1);
this.back({ vote: psdoc.vote, user_vote: -1 });
}