Merge pull request #16545 from overleaf/dp-project-owner-delete-labels

Allow project owners to delete history labels

GitOrigin-RevId: 16111337681ac4085db2cf48e9d4c2fa87993b77
This commit is contained in:
David
2024-01-23 09:03:08 +00:00
committed by Copybot
parent 4683cad1cb
commit e3513a9d50
11 changed files with 198 additions and 15 deletions
@@ -128,6 +128,20 @@ class MockProjectHistoryApi extends AbstractMockApi {
}
)
this.app.delete('/project/:projectId/labels/:labelId', (req, res) => {
const { projectId, labelId } = req.params
const label =
this.labels[projectId] != null
? this.labels[projectId][labelId]
: undefined
if (label != null) {
this.deleteLabel(projectId, labelId)
res.sendStatus(204)
} else {
res.sendStatus(404)
}
})
this.app.post('/project/:projectId/flush', (req, res) => {
res.sendStatus(200)
})
@@ -38,6 +38,7 @@ describe('HistoryController', function () {
'../Project/ProjectEntityUpdateHandler':
(this.ProjectEntityUpdateHandler = {}),
'../User/UserGetter': (this.UserGetter = {}),
'../Project/ProjectGetter': (this.ProjectGetter = {}),
'./RestoreManager': (this.RestoreManager = {}),
'../../infrastructure/Features': (this.Features = sinon
.stub()