fix: keep link addresses in the plain text version of emails
MR
16h ago+41+41+01234567890123456789-3-3-0123456789
Closes #34216
Proposed changes
The text/plain part of an email is generated from its html with stripHtml, which drops every href. In offline message alerts the text part read admin sent you a message GO TO MESSAGE with no address, so recipients using "Send only plain text emails" or a plain text client had no way to open the message.
- New
htmlToPlainText(server/lib/notifications/email/): the samestripHtmlconversion, withdumpLinkHrefsNearbyenabled so each link's address follows its label, e.g.GO TO MESSAGE (https://…/direct/abc?msg=xyz). This uses the same options thatEmailInbox_Incomingalready passes for incoming emails. - The mailer uses it in both places where it derives
textfromhtml(sendandsendNoWrap). Emails that pass an explicittextare unchanged.
Steps to test or reproduce
- Enable "Send only plain text emails" (or read the text/plain part).
- Receive an offline message alert.
- Before:
GO TO MESSAGEwith no link. After:GO TO MESSAGE (<message url>).
Tests
htmlToPlainText.test.ts: the link case fails on develop with expected 'admin sent you a message GO TO MESSAGE' to include 'GO TO MESSAGE (https://…)' and passes with this change. The existing mailer and getEmailContent tests still pass.
Summary by CodeRabbit
- Bug Fixes
- Plain-text emails now include link addresses alongside their labels, including the “Go to message” link in offline message alerts.