mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Renamed trigger amount variable
refs https://github.com/TryGhost/Toolbox/issues/387 - Similar reasoning as to previous renames - the variables were named with a single trigger source in mind and now would be confusing with multiple verification trigger sources.
This commit is contained in:
parent
1e96ef849f
commit
7cae68baaa
3 changed files with 10 additions and 9 deletions
|
@ -108,7 +108,7 @@ module.exports = {
|
||||||
apiTriggerThreshold: _.get(config.get('hostSettings'), 'emailVerification.importThreshold'),
|
apiTriggerThreshold: _.get(config.get('hostSettings'), 'emailVerification.importThreshold'),
|
||||||
isVerified: () => config.get('hostSettings:emailVerification:verified') === true,
|
isVerified: () => config.get('hostSettings:emailVerification:verified') === true,
|
||||||
isVerificationRequired: () => settingsCache.get('email_verification_required') === true,
|
isVerificationRequired: () => settingsCache.get('email_verification_required') === true,
|
||||||
sendVerificationEmail: ({subject, message, amountImported}) => {
|
sendVerificationEmail: ({subject, message, amountTriggered}) => {
|
||||||
const escalationAddress = config.get('hostSettings:emailVerification:escalationAddress');
|
const escalationAddress = config.get('hostSettings:emailVerification:escalationAddress');
|
||||||
const fromAddress = config.get('user_email');
|
const fromAddress = config.get('user_email');
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ module.exports = {
|
||||||
ghostMailer.send({
|
ghostMailer.send({
|
||||||
subject,
|
subject,
|
||||||
html: tpl(message, {
|
html: tpl(message, {
|
||||||
importedNumber: amountImported,
|
amountTriggered: amountTriggered,
|
||||||
siteUrl: urlUtils.getSiteUrl()
|
siteUrl: urlUtils.getSiteUrl()
|
||||||
}),
|
}),
|
||||||
forceTextContent: true,
|
forceTextContent: true,
|
||||||
|
|
|
@ -5,8 +5,8 @@ const {MemberSubscribeEvent} = require('@tryghost/member-events');
|
||||||
const messages = {
|
const messages = {
|
||||||
emailVerificationNeeded: `We're hard at work processing your import. To make sure you get great deliverability on a list of that size, we'll need to enable some extra features for your account. A member of our team will be in touch with you by email to review your account make sure everything is configured correctly so you're ready to go.`,
|
emailVerificationNeeded: `We're hard at work processing your import. To make sure you get great deliverability on a list of that size, we'll need to enable some extra features for your account. A member of our team will be in touch with you by email to review your account make sure everything is configured correctly so you're ready to go.`,
|
||||||
emailVerificationEmailSubject: `Email needs verification`,
|
emailVerificationEmailSubject: `Email needs verification`,
|
||||||
emailVerificationEmailMessageImport: `Email verification needed for site: {siteUrl}, has imported: {importedNumber} members in the last 30 days.`,
|
emailVerificationEmailMessageImport: `Email verification needed for site: {siteUrl}, has imported: {amountTriggered} members in the last 30 days.`,
|
||||||
emailVerificationEmailMessageAPI: `Email verification needed for site: {siteUrl} has added: {importedNumber} members through the API in the last 30 days.`
|
emailVerificationEmailMessageAPI: `Email verification needed for site: {siteUrl} has added: {amountTriggered} members through the API in the last 30 days.`
|
||||||
};
|
};
|
||||||
|
|
||||||
class VerificationTrigger {
|
class VerificationTrigger {
|
||||||
|
@ -16,7 +16,7 @@ class VerificationTrigger {
|
||||||
* @param {number} deps.apiTriggerThreshold Threshold for triggering verification as defined in config
|
* @param {number} deps.apiTriggerThreshold Threshold for triggering verification as defined in config
|
||||||
* @param {() => boolean} deps.isVerified Check Ghost config to see if we are already verified
|
* @param {() => boolean} deps.isVerified Check Ghost config to see if we are already verified
|
||||||
* @param {() => boolean} deps.isVerificationRequired Check Ghost settings to see whether verification has been requested
|
* @param {() => boolean} deps.isVerificationRequired Check Ghost settings to see whether verification has been requested
|
||||||
* @param {(content: {subject: string, message: string, amountImported: number}) => {}} deps.sendVerificationEmail Sends an email to the escalation address to confirm that customer needs to be verified
|
* @param {(content: {subject: string, message: string, amountTriggered: number}) => void} deps.sendVerificationEmail Sends an email to the escalation address to confirm that customer needs to be verified
|
||||||
* @param {any} deps.membersStats MemberStats service
|
* @param {any} deps.membersStats MemberStats service
|
||||||
* @param {any} deps.Settings Ghost Settings model
|
* @param {any} deps.Settings Ghost Settings model
|
||||||
* @param {any} deps.eventRepository For querying events
|
* @param {any} deps.eventRepository For querying events
|
||||||
|
@ -132,7 +132,7 @@ class VerificationTrigger {
|
||||||
? messages.emailVerificationEmailMessageAPI
|
? messages.emailVerificationEmailMessageAPI
|
||||||
: messages.emailVerificationEmailMessageImport,
|
: messages.emailVerificationEmailMessageImport,
|
||||||
subject: messages.emailVerificationEmailSubject,
|
subject: messages.emailVerificationEmailSubject,
|
||||||
amountImported
|
amountTriggered: amount
|
||||||
});
|
});
|
||||||
|
|
||||||
if (throwOnTrigger) {
|
if (throwOnTrigger) {
|
||||||
|
|
|
@ -151,7 +151,7 @@ describe('Email verification flow', function () {
|
||||||
emailStub.lastCall.firstArg.should.eql({
|
emailStub.lastCall.firstArg.should.eql({
|
||||||
subject: 'Email needs verification',
|
subject: 'Email needs verification',
|
||||||
message: 'Email verification needed for site: {siteUrl}, has imported: {importedNumber} members in the last 30 days.',
|
message: 'Email verification needed for site: {siteUrl}, has imported: {importedNumber} members in the last 30 days.',
|
||||||
amountImported: 10
|
amountTriggered: 10
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ describe('Email verification flow', function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
new VerificationTrigger({
|
new VerificationTrigger({
|
||||||
configThreshold: 2,
|
apiTriggerThreshold: 2,
|
||||||
Settings: {
|
Settings: {
|
||||||
edit: settingsStub
|
edit: settingsStub
|
||||||
},
|
},
|
||||||
|
@ -230,9 +230,10 @@ describe('Email verification flow', function () {
|
||||||
emailStub.lastCall.firstArg.should.eql({
|
emailStub.lastCall.firstArg.should.eql({
|
||||||
subject: 'Email needs verification',
|
subject: 'Email needs verification',
|
||||||
message: 'Email verification needed for site: {siteUrl}, has imported: {importedNumber} members in the last 30 days.',
|
message: 'Email verification needed for site: {siteUrl}, has imported: {importedNumber} members in the last 30 days.',
|
||||||
amountImported: 10
|
amountTriggered: 10
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('Does not fetch events and trigger when threshold is Infinity', async function () {
|
it('Does not fetch events and trigger when threshold is Infinity', async function () {
|
||||||
const emailStub = sinon.stub().resolves(null);
|
const emailStub = sinon.stub().resolves(null);
|
||||||
|
|
Loading…
Add table
Reference in a new issue