0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-17 23:44:39 -05:00

Fixed verification threshold when set to 0

no issue

- if the verification threshold is 0, `_.get(..)` becomes falsy so we
  fallback to Infinity
- this is not correct - we only want to default to Infinity if the value
  is not set
- this commit explicitly compares the config value to `undefined` and sets
  the fallback accordingly
This commit is contained in:
Daniel Lockyer 2021-10-22 15:28:50 +02:00
parent d7fbf94d91
commit e834904125
No known key found for this signature in database
GPG key ID: D21186F0B47295AD

View file

@ -61,7 +61,8 @@ function reconfigureMembersAPI() {
*/
const fetchImportThreshold = async () => {
const membersTotal = await membersService.stats.getTotalMembers();
const volumeThreshold = _.get(config.get('hostSettings'), 'emailVerification.importThreshold') || Infinity;
const configThreshold = _.get(config.get('hostSettings'), 'emailVerification.importThreshold');
const volumeThreshold = (configThreshold === undefined) ? Infinity : configThreshold;
const threshold = Math.max(membersTotal, volumeThreshold);
return threshold;