diff --git a/server/api/events.js b/server/api/events.js index 94218aea8..84e4fc7cc 100644 --- a/server/api/events.js +++ b/server/api/events.js @@ -44,6 +44,7 @@ router.post('events.list', auth(), pagination(), async ctx => { { model: User, as: 'actor', + paranoid: false, }, ], offset: ctx.state.pagination.offset, diff --git a/server/api/events.test.js b/server/api/events.test.js index 724426852..820413b05 100644 --- a/server/api/events.test.js +++ b/server/api/events.test.js @@ -39,6 +39,30 @@ describe('#events.list', async () => { expect(body.data[0].id).toEqual(event.id); }); + it('should return events with deleted actors', async () => { + const { user, admin, document, collection } = await seed(); + + // event viewable in activity stream + const event = await buildEvent({ + name: 'documents.publish', + collectionId: collection.id, + documentId: document.id, + teamId: user.teamId, + actorId: user.id, + }); + + await user.destroy(); + + const res = await server.post('/api/events.list', { + body: { token: admin.getJwtToken() }, + }); + const body = await res.json(); + + expect(res.status).toEqual(200); + expect(body.data.length).toEqual(1); + expect(body.data[0].id).toEqual(event.id); + }); + it('should require authentication', async () => { const res = await server.post('/api/events.list'); const body = await res.json();