0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Refactored verification trigger constructor

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

- The constructor should be light initialization logic only. Putting business logic into constructor is quite dirty and not really testable!
This commit is contained in:
Naz 2022-08-24 14:06:05 +08:00
parent 456abc3ef2
commit 5934794d86

View file

@ -38,7 +38,11 @@ class VerificationTrigger {
this._Settings = Settings;
this._eventRepository = eventRepository;
DomainEvents.subscribe(MemberSubscribeEvent, async (event) => {
this._handleMemberSubscribeEvent = this._handleMemberSubscribeEvent.bind(this);
DomainEvents.subscribe(MemberSubscribeEvent, this._handleMemberSubscribeEvent);
}
async _handleMemberSubscribeEvent(event) {
if (event.data.source === 'api' && isFinite(this._configThreshold)) {
const createdAt = new Date();
createdAt.setDate(createdAt.getDate() - 30);
@ -55,7 +59,6 @@ class VerificationTrigger {
});
}
}
});
}
async getImportThreshold() {