ActivityPub-federated video streaming platform using P2P directly in your web browser
Fix email title
Chocobozzza6f1ebfdfa74
diff --git a/packages/tests/fixtures/peertube-plugin-test-four/main.js b/packages/tests/fixtures/peertube-plugin-test-four/main.jsindex 01b1651f1a..84105f6246 100644--- a/packages/tests/fixtures/peertube-plugin-test-four/main.js+++ b/packages/tests/fixtures/peertube-plugin-test-four/main.js@@ -186,6 +186,7 @@ async function register ({await peertubeHelpers.email.createJob({to: { email: req.body.to, language: 'en' },subject: req.body.subject,+ title: req.body.title,text: req.body.text})diff --git a/packages/tests/src/plugins/plugin-helpers.ts b/packages/tests/src/plugins/plugin-helpers.tsindex 63dac2e63a..5336f2ef5b 100644--- a/packages/tests/src/plugins/plugin-helpers.ts+++ b/packages/tests/src/plugins/plugin-helpers.ts@@ -147,6 +147,35 @@ describe('Test plugin helpers', function () {expect(email['to'][0]['address']).to.equal('[email protected]')expect(email['subject']).to.contain('Email sent by a plugin')expect(email['text']).to.contain('Hello from plugin four')++ // No title provided, so the subject is used as the HTML heading+ expect(email['html']).to.contain('Email sent by a plugin')+ })++ it('Should send an email with a custom title', async function () {+ await makePostBodyRequest({+ url: servers[0].url,+ path: '/plugins/test-four/router/send-email',+ fields: {+ to: '[email protected]',+ subject: 'Email sent by a plugin',+ title: 'Custom email title',+ text: 'Hello from plugin four'+ },+ expectedStatus: HttpStatusCode.CREATED_201+ })++ await waitJobs(servers)++ expect(emails).to.have.lengthOf(2)++ const email = emails[1]+ expect(email['to'][0]['address']).to.equal('[email protected]')+ expect(email['subject']).to.contain('Email sent by a plugin')+ expect(email['text']).to.contain('Hello from plugin four')++ // The custom title is used as the HTML heading, not the subject+ expect(email['html']).to.contain('Custom email title')})})diff --git a/server/core/lib/emailer.ts b/server/core/lib/emailer.tsindex d957e949bb..ae9f4c9da8 100644--- a/server/core/lib/emailer.ts+++ b/server/core/lib/emailer.ts@@ -490,7 +490,7 @@ export class Emailer {WEBSERVER,instanceName: CONFIG.INSTANCE.NAME,subject,- title: options.text,+ title: options.title,action: options.action,text: options.text, // If MailTextsignature: this.buildSignature(),