mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 22:23:42 +01:00
Allow reviewers to resolve their own comments (#22582)
* Allow reviewers to resolve their own comments * check if reviewer is comment author * add missing translation * add CommentsController tests * added DocumentManagerTests * added HttpControllerTests * Add AuthorizationManagerTests * added AuthorizationMiddlewareTests * added DocumentUpdaterHandler test * fix test descriptions * remove returns from CommentsControllerTests * use ensureUserCanResolveThread in authorizationMiddleware * move canResolveThread to AuthorizationManager * commentId as param in NotFoundError * refactor canUserResolveThread GitOrigin-RevId: 131c3d1eb9ac916eaaa9221d351a92bc07b80cdc
This commit is contained in:
committed by
Copybot
parent
19ee929d65
commit
30ebad91b7
@@ -49,6 +49,29 @@ function getDoc(req, res, next) {
|
||||
)
|
||||
}
|
||||
|
||||
function getComment(req, res, next) {
|
||||
const docId = req.params.doc_id
|
||||
const projectId = req.params.project_id
|
||||
const commentId = req.params.comment_id
|
||||
|
||||
logger.debug({ projectId, docId, commentId }, 'getting comment via http')
|
||||
|
||||
DocumentManager.getCommentWithLock(
|
||||
projectId,
|
||||
docId,
|
||||
commentId,
|
||||
(error, comment) => {
|
||||
if (error) {
|
||||
return next(error)
|
||||
}
|
||||
if (comment == null) {
|
||||
return next(new Errors.NotFoundError('comment not found'))
|
||||
}
|
||||
res.json(comment)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
// return the doc from redis if present, but don't load it from mongo
|
||||
function peekDoc(req, res, next) {
|
||||
const docId = req.params.doc_id
|
||||
@@ -506,4 +529,5 @@ module.exports = {
|
||||
flushQueuedProjects,
|
||||
blockProject,
|
||||
unblockProject,
|
||||
getComment,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user