0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Renamed verification parameters

refs https://github.com/TryGhost/Toolbox/issues/387

- The "amountImported" was to specific to one verification trigger source. There can be multiple sources that start the verification process.
- Changed `startVerificationProcess` method signature to reflect it's a private method that's only used internally - exposed for testing purposes only.
This commit is contained in:
Naz 2022-08-25 09:47:59 +08:00
parent 780faf990b
commit 1e96ef849f
2 changed files with 17 additions and 17 deletions

View file

@ -55,8 +55,8 @@ class VerificationTrigger {
});
if (events.meta.pagination.total > sourceThreshold) {
await this.startVerificationProcess({
amountImported: events.meta.pagination.total,
await this._startVerificationProcess({
amount: events.meta.pagination.total,
throwOnTrigger: false,
source: source
});
@ -93,8 +93,8 @@ class VerificationTrigger {
// the last 30 days) or the threshold defined in config, whichever is greater.
const importThreshold = Math.max(membersTotal - events.meta.pagination.total, this._apiTriggerThreshold);
if (isFinite(importThreshold) && events.meta.pagination.total > importThreshold) {
await this.startVerificationProcess({
amountImported: events.meta.pagination.total,
await this._startVerificationProcess({
amount: events.meta.pagination.total,
throwOnTrigger: false,
source: 'import'
});
@ -109,13 +109,13 @@ class VerificationTrigger {
/**
*
* @param {object} config
* @param {number} config.amountImported Amount of members which were imported
* @param {number} config.amount The amount of members that triggered the verification process
* @param {boolean} config.throwOnTrigger Whether to throw if verification is needed
* @param {string} config.source Source of the verification trigger - currently either 'api' or 'import'
* @returns {Promise<IVerificationResult>} Object containing property "needsVerification" - true when triggered
*/
async startVerificationProcess({
amountImported,
async _startVerificationProcess({
amount,
throwOnTrigger,
source
}) {

View file

@ -59,8 +59,8 @@ describe('Email verification flow', function () {
sendVerificationEmail: emailStub
});
const result = await trigger.startVerificationProcess({
amountImported: 10,
const result = await trigger._startVerificationProcess({
amount: 10,
throwOnTrigger: false
});
@ -81,8 +81,8 @@ describe('Email verification flow', function () {
sendVerificationEmail: emailStub
});
const result = await trigger.startVerificationProcess({
amountImported: 10,
const result = await trigger._startVerificationProcess({
amount: 10,
throwOnTrigger: false
});
@ -103,8 +103,8 @@ describe('Email verification flow', function () {
sendVerificationEmail: emailStub
});
const result = await trigger.startVerificationProcess({
amountImported: 10,
const result = await trigger._startVerificationProcess({
amount: 10,
throwOnTrigger: false
});
@ -125,8 +125,8 @@ describe('Email verification flow', function () {
sendVerificationEmail: emailStub
});
await trigger.startVerificationProcess({
amountImported: 10,
await trigger._startVerificationProcess({
amount: 10,
throwOnTrigger: true
}).should.be.rejected();
});
@ -143,8 +143,8 @@ describe('Email verification flow', function () {
sendVerificationEmail: emailStub
});
await trigger.startVerificationProcess({
amountImported: 10,
await trigger._startVerificationProcess({
amount: 10,
throwOnTrigger: false
});