Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix email links displayed twice as text

Chocobozzz3c7ddd7daa61
diff --git a/server/lib/emailer.ts b/server/lib/emailer.ts
index ebad436502..fe56688816 100644
--- a/server/lib/emailer.ts
+++ b/server/lib/emailer.ts
@@ -141,6 +141,12 @@ class Emailer {
const email = new Email({
send: true,
+ htmlToText: {
+ selectors: [
+ { selector: 'img', format: 'skip' },
+ { selector: 'a', options: { ignoreHref: true } }
+ ]
+ },
message: {
from: `"${fromDisplayName}" <${CONFIG.SMTP.FROM_ADDRESS}>`
},
diff --git a/server/tests/api/server/contact-form.ts b/server/tests/api/server/contact-form.ts
index f3facb04a1..4f01f6fd50 100644
--- a/server/tests/api/server/contact-form.ts
+++ b/server/tests/api/server/contact-form.ts
@@ -61,6 +61,13 @@ describe('Test contact form', function () {
expect(email['text']).contains('my super message')
})
+ it('Should not have duplicated email adress in text message', async function () {
+ const text = emails[0]['text'] as string
+
+ const matches = text.match(/[email protected]/g)
+ expect(matches).to.have.lengthOf(1)
+ })
+
it('Should not be able to send another contact form because of the anti spam checker', async function () {
this.timeout(10000)