From 3ceb9c4a0efad6dddd03cd56903643ecf0e109f8 Mon Sep 17 00:00:00 2001 From: Artem Savchenko Date: Fri, 23 May 2025 13:24:07 +0700 Subject: [PATCH] UBERF-11067: Minor fixes Signed-off-by: Artem Savchenko --- .../mail/mail-common/src/__tests__/__mocks__/meetingMail.html | 2 +- services/mail/mail-common/src/__tests__/md.test.ts | 4 ++++ services/mail/mail-common/src/utils.ts | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/services/mail/mail-common/src/__tests__/__mocks__/meetingMail.html b/services/mail/mail-common/src/__tests__/__mocks__/meetingMail.html index 0485857b90..cc9b4f203b 100644 --- a/services/mail/mail-common/src/__tests__/__mocks__/meetingMail.html +++ b/services/mail/mail-common/src/__tests__/__mocks__/meetingMail.html @@ -32,4 +32,4 @@ See all guest details
Send response to user@example.com
-
Yes
No
Maybe
More options

Invitation from Google Calendar

You received this email because you are subscribed to calendar notifications. To stop receiving these emails, open Calendar settings and change your notification preferences.

\ No newline at end of file +
Yes
No
Maybe
More options

Invitation from Google Calendar

You received this email because you are subscribed to calendar notifications. To stop receiving these emails, open Calendar settings and change your notification preferences.

\ No newline at end of file diff --git a/services/mail/mail-common/src/__tests__/md.test.ts b/services/mail/mail-common/src/__tests__/md.test.ts index fd4173a3ef..3ad6d820e7 100644 --- a/services/mail/mail-common/src/__tests__/md.test.ts +++ b/services/mail/mail-common/src/__tests__/md.test.ts @@ -78,6 +78,10 @@ describe('getMdContent', () => { // Verify we have the expected guest entries expect(result).toContain('John Doe') expect(result).toContain('Sarah Jones') + + expect(result).toContain('[Yes](https://example.com/1)') + expect(result).toContain('[No](https://example.com/2)') + expect(result).toContain('[Maybe](https://example.com/3)') }) it('should handle undefined content gracefully', () => { diff --git a/services/mail/mail-common/src/utils.ts b/services/mail/mail-common/src/utils.ts index 538c2f5757..27503550d1 100644 --- a/services/mail/mail-common/src/utils.ts +++ b/services/mail/mail-common/src/utils.ts @@ -33,10 +33,10 @@ export function getMdContent (ctx: MeasureContext, email: EmailMessage): string const title = element.title ?? '' // Trim content to prevent empty lines inside links const trimmedContent = content.trim().replace(/\n\s*\n/g, ' ') - if (!href) { + if (href == null) { return trimmedContent } - const titlePart = title ? ` "${title}"` : '' + const titlePart = title !== '' ? ` "${title}"` : '' return `[${trimmedContent}](${href}${titlePart})` } catch (error: any) { ctx.warn('Failed to parse link', { error: error.message })