Changed subject lines for comment emails

fixes https://github.com/TryGhost/Team/issues/1735
This commit is contained in:
Simon Backx 2022-08-02 17:17:33 +02:00
parent 9652d5ab32
commit 3f8ddd61f9
2 changed files with 8 additions and 7 deletions

View File

@ -26,7 +26,7 @@ class CommentsServiceEmails {
} }
const to = author.get('email'); const to = author.get('email');
const subject = '💬 You have a new comment on one of your posts'; const subject = '💬 New comment on your post: ' + post.get('title');
const memberName = member.get('name') || 'Anonymous'; const memberName = member.get('name') || 'Anonymous';
@ -72,7 +72,7 @@ class CommentsServiceEmails {
} }
const to = parentMember.get('email'); const to = parentMember.get('email');
const subject = '💬 You have a new reply on one of your comments'; const subject = '↪️ New reply to your comment on ' + this.settingsCache.get('title');
const post = await this.models.Post.findOne({id: reply.get('post_id')}); const post = await this.models.Post.findOne({id: reply.get('post_id')});
const member = await this.models.Member.findOne({id: reply.get('member_id')}); const member = await this.models.Member.findOne({id: reply.get('member_id')});

View File

@ -7,7 +7,7 @@ const moment = require('moment-timezone');
const settingsCache = require('../../../core/shared/settings-cache'); const settingsCache = require('../../../core/shared/settings-cache');
const sinon = require('sinon'); const sinon = require('sinon');
let membersAgent, membersAgent2, member, postId, commentId; let membersAgent, membersAgent2, member, postId, postTitle, commentId;
const commentMatcherNoMember = { const commentMatcherNoMember = {
id: anyObjectId, id: anyObjectId,
@ -55,6 +55,7 @@ describe('Comments API', function () {
await fixtureManager.init('posts', 'members', 'comments'); await fixtureManager.init('posts', 'members', 'comments');
postId = fixtureManager.get('posts', 0).id; postId = fixtureManager.get('posts', 0).id;
postTitle = fixtureManager.get('posts', 0).title;
}); });
beforeEach(function () { beforeEach(function () {
@ -180,7 +181,7 @@ describe('Comments API', function () {
// Check if author got an email // Check if author got an email
mockManager.assert.sentEmailCount(1); mockManager.assert.sentEmailCount(1);
mockManager.assert.sentEmail({ mockManager.assert.sentEmail({
subject: '💬 You have a new comment on one of your posts', subject: '💬 New comment on your post: ' + postTitle,
to: fixtureManager.get('users', 0).email, to: fixtureManager.get('users', 0).email,
// Note that the <strong> tag is removed by the sanitizer // Note that the <strong> tag is removed by the sanitizer
html: new RegExp(escapeRegExp('<p>This is a message</p><p>New line</p>')) html: new RegExp(escapeRegExp('<p>This is a message</p><p>New line</p>'))
@ -234,7 +235,7 @@ describe('Comments API', function () {
// Check only the author got an email (because we are the author of this parent comment) // Check only the author got an email (because we are the author of this parent comment)
mockManager.assert.sentEmailCount(1); mockManager.assert.sentEmailCount(1);
mockManager.assert.sentEmail({ mockManager.assert.sentEmail({
subject: '💬 You have a new comment on one of your posts', subject: '💬 New comment on your post: ' + postTitle,
to: fixtureManager.get('users', 0).email to: fixtureManager.get('users', 0).email
}); });
@ -271,12 +272,12 @@ describe('Comments API', function () {
mockManager.assert.sentEmailCount(2); mockManager.assert.sentEmailCount(2);
mockManager.assert.sentEmail({ mockManager.assert.sentEmail({
subject: '💬 You have a new comment on one of your posts', subject: '💬 New comment on your post: ' + postTitle,
to: fixtureManager.get('users', 0).email to: fixtureManager.get('users', 0).email
}); });
mockManager.assert.sentEmail({ mockManager.assert.sentEmail({
subject: '💬 You have a new reply on one of your comments', subject: '↪️ New reply to your comment on Ghost',
to: fixtureManager.get('members', 0).email to: fixtureManager.get('members', 0).email
}); });