mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -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:
parent
456abc3ef2
commit
5934794d86
1 changed files with 19 additions and 16 deletions
|
@ -38,7 +38,11 @@ class VerificationTrigger {
|
||||||
this._Settings = Settings;
|
this._Settings = Settings;
|
||||||
this._eventRepository = eventRepository;
|
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)) {
|
if (event.data.source === 'api' && isFinite(this._configThreshold)) {
|
||||||
const createdAt = new Date();
|
const createdAt = new Date();
|
||||||
createdAt.setDate(createdAt.getDate() - 30);
|
createdAt.setDate(createdAt.getDate() - 30);
|
||||||
|
@ -55,7 +59,6 @@ class VerificationTrigger {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async getImportThreshold() {
|
async getImportThreshold() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue