Merge pull request #19041 from overleaf/em-docupdater-block-project

Endpoint for blocking projects from being loaded in docupdater

GitOrigin-RevId: 87d79a0b8ccfa0ed46fbf0c198e8a405c1c1151f
This commit is contained in:
Eric Mc Sween
2024-07-03 08:04:40 +00:00
committed by Copybot
parent f77894c427
commit e8e31dbdb5
5 changed files with 191 additions and 62 deletions
@@ -443,6 +443,35 @@ function flushQueuedProjects(req, res, next) {
})
}
/**
* Block a project from getting loaded in docupdater
*
* The project is blocked only if it's not already loaded in docupdater. The
* response indicates whether the project has been blocked or not.
*/
function blockProject(req, res, next) {
const projectId = req.params.project_id
RedisManager.blockProject(projectId, (err, blocked) => {
if (err) {
return next(err)
}
res.json({ blocked })
})
}
/**
* Unblock a project
*/
function unblockProject(req, res, next) {
const projectId = req.params.project_id
RedisManager.unblockProject(projectId, (err, wasBlocked) => {
if (err) {
return next(err)
}
res.json({ wasBlocked })
})
}
module.exports = {
getDoc,
peekDoc,
@@ -462,4 +491,6 @@ module.exports = {
resyncProjectHistory,
flushAllProjects,
flushQueuedProjects,
blockProject,
unblockProject,
}