diff --git a/backend/src/graphql/resolver/ContributionResolver.test.ts b/backend/src/graphql/resolver/ContributionResolver.test.ts index dcbf0d52e..c3df9bd1d 100644 --- a/backend/src/graphql/resolver/ContributionResolver.test.ts +++ b/backend/src/graphql/resolver/ContributionResolver.test.ts @@ -1633,7 +1633,11 @@ describe('ContributionResolver', () => { it('logs the error thrown', () => { expect(logger.error).toBeCalledWith( 'Cannot create contribution since the user was deleted', - expect.objectContaining({ deletedAt: new Date('2018-03-14T09:17:52.000Z') }), + expect.objectContaining({ + user: expect.objectContaining({ + deletedAt: new Date('2018-03-14T09:17:52.000Z'), + }), + }), ) }) }) diff --git a/backend/src/graphql/resolver/ContributionResolver.ts b/backend/src/graphql/resolver/ContributionResolver.ts index 8765d29a8..340d99524 100644 --- a/backend/src/graphql/resolver/ContributionResolver.ts +++ b/backend/src/graphql/resolver/ContributionResolver.ts @@ -307,14 +307,8 @@ export class ContributionResolver { if (!emailContact) { throw new LogError('Could not find user', email) } - if (emailContact.deletedAt) { - throw new LogError( - 'Cannot create contribution since the emailContact was deleted', - emailContact, - ) - } - if (emailContact.user.deletedAt) { - throw new LogError('Cannot create contribution since the user was deleted', emailContact.user) + if (emailContact.deletedAt || emailContact.user.deletedAt) { + throw new LogError('Cannot create contribution since the user was deleted', emailContact) } if (!emailContact.emailChecked) { throw new LogError( diff --git a/backend/src/seeds/users/stephen-hawking.ts b/backend/src/seeds/users/stephen-hawking.ts index a683b7579..6c4f34d10 100644 --- a/backend/src/seeds/users/stephen-hawking.ts +++ b/backend/src/seeds/users/stephen-hawking.ts @@ -1,5 +1,6 @@ import { UserInterface } from './UserInterface' +// TODO: the generated email_contact is not deleted export const stephenHawking: UserInterface = { email: 'stephen@hawking.uk', firstName: 'Stephen',