fix(api): trim trailing space if no reporter name (#52199)

This commit is contained in:
Oliver Eyton-Williams
2023-11-03 16:38:19 +01:00
committed by GitHub
parent d4e65df8b0
commit 3940eddbbb
2 changed files with 8 additions and 6 deletions

View File

@@ -723,9 +723,11 @@ describe('userRoutes', () => {
});
test('POST returns 200 status code with "success" message', async () => {
const testUser = await fastifyTestInstance.prisma.user.findFirst({
where: { email: testUserData.email }
});
const testUser = await fastifyTestInstance.prisma.user.findFirstOrThrow(
{
where: { email: testUserData.email }
}
);
const response = await superRequest('/user/report-user', {
method: 'POST',
setCookies
@@ -751,8 +753,8 @@ Luke, I am your father
Reported by:
Username: ${testUser?.username ?? ''}
Name:
Username: ${testUser.username}
Name:
Email: foo@bar.com
Thanks and regards,

View File

@@ -24,7 +24,7 @@ ${reportDesc}
Reported by:
Username: ${reporter.username}
Name: ${reporter.name ?? ''}
Name:${reporter.name ? ' ' + reporter.name : ''}
Email: ${reporter.email}
Thanks and regards,