Fix add-email preserve identity email state flow

This commit is contained in:
QLHazyCoder
2026-05-12 03:49:22 +08:00
parent f81cc74c29
commit c3423b21ab
12 changed files with 670 additions and 26 deletions
+13 -1
View File
@@ -17,6 +17,7 @@
normalizeCloudMailDomain,
normalizeCloudMailDomains,
normalizeCloudMailMailApiMessages,
persistRegistrationEmailState = null,
pickVerificationMessageWithTimeFallback,
setEmailState = async () => {},
setPersistentSettings = async () => {},
@@ -24,6 +25,14 @@
throwIfStopped = () => {},
} = deps;
async function persistResolvedEmailState(state = null, email, options = {}) {
if (typeof persistRegistrationEmailState === 'function') {
await persistRegistrationEmailState(state, email, options);
return;
}
await setEmailState(email, options);
}
function getCloudMailConfig(state = {}) {
return {
baseUrl: normalizeCloudMailBaseUrl(state.cloudMailBaseUrl),
@@ -185,7 +194,10 @@
throw err;
}
}
await setEmailState(address, { source: 'generated:cloudmail' });
await persistResolvedEmailState(latestState, address, {
source: 'generated:cloudmail',
preserveAccountIdentity: Boolean(options?.preserveAccountIdentity),
});
await addLog(`Cloud Mail:已生成 ${address}`, 'ok');
return address;
}