1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-03 09:49:20 +02:00

fix(plugins/hooks): call user delete upon delete me

closes #6859
This commit is contained in:
kontrollanten 2025-01-27 22:37:13 +01:00 committed by Chocobozzz
parent 61ca8f8d6e
commit 372e15eb49
2 changed files with 9 additions and 0 deletions

View file

@ -230,6 +230,13 @@ describe('Test plugin action hooks', function () {
await checkHook('action:api.user.deleted') await checkHook('action:api.user.deleted')
}) })
it('Should run action:api.user.deleted upon delete me', async function () {
const token = await servers[0].users.generateUserAndToken('delete_me_user')
await servers[0].users.deleteMe({ token })
await checkHook('action:api.user.deleted', true, 2)
})
}) })
describe('Playlist hooks', function () { describe('Playlist hooks', function () {

View file

@ -244,6 +244,8 @@ async function deleteMe (req: express.Request, res: express.Response) {
await user.destroy() await user.destroy()
Hooks.runAction('action:api.user.deleted', { user, req, res })
return res.status(HttpStatusCode.NO_CONTENT_204).end() return res.status(HttpStatusCode.NO_CONTENT_204).end()
} }