mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
core: check perm for solution voting (#1089)
This commit is contained in:
1 parent
6bed7e4cac
commit
effc7da312
1 file changed
+2
@@ -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 });
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user