mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 19:33:02 +03:00
Moved email verification logic into separate method
refs https://github.com/TryGhost/Team/issues/912 - The processImport method was becoming to big and unreadable - Having small methods is easier to extract if needed later
This commit is contained in:
parent
93e8814589
commit
fa33235fd9
@ -67,14 +67,10 @@ const membersImporter = new MembersCSVImporter({
|
|||||||
importThreshold: getThreshold()
|
importThreshold: getThreshold()
|
||||||
});
|
});
|
||||||
|
|
||||||
const processImport = async (options) => {
|
const startEmailVerification = async () => {
|
||||||
const result = await membersImporter.process(options);
|
|
||||||
const freezeTriggered = result.meta.freeze;
|
|
||||||
delete result.meta.freeze;
|
|
||||||
|
|
||||||
const isVerifiedEmail = config.get('hostSettings:emailVerification:verified') === true;
|
const isVerifiedEmail = config.get('hostSettings:emailVerification:verified') === true;
|
||||||
|
|
||||||
if ((!isVerifiedEmail) && freezeTriggered) {
|
if ((!isVerifiedEmail)) {
|
||||||
await models.Settings.edit([{
|
await models.Settings.edit([{
|
||||||
key: 'email_freeze',
|
key: 'email_freeze',
|
||||||
value: true
|
value: true
|
||||||
@ -84,6 +80,16 @@ const processImport = async (options) => {
|
|||||||
message: tpl(messages.emailVerificationNeeded)
|
message: tpl(messages.emailVerificationNeeded)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const processImport = async (options) => {
|
||||||
|
const result = await membersImporter.process(options);
|
||||||
|
const freezeTriggered = result.meta.freeze;
|
||||||
|
delete result.meta.freeze;
|
||||||
|
|
||||||
|
if (freezeTriggered) {
|
||||||
|
await startEmailVerification();
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user