feat: upgrade custom email pool with manager UI and entry states

(cherry picked from commit 3cf5f22d40a4ef563a3d06751bbb25b003d4ef1e)
This commit is contained in:
朴圣佑
2026-04-24 13:33:59 +08:00
committed by QLHazyCoder
parent 20c634646e
commit f480af0375
7 changed files with 975 additions and 74 deletions
@@ -54,6 +54,7 @@ function extractFunction(name) {
const bundle = [
extractFunction('normalizeEmailGenerator'),
extractFunction('normalizeCustomEmailPool'),
extractFunction('normalizeCustomEmailPoolEntryObjects'),
extractFunction('getCustomEmailPool'),
extractFunction('getCustomEmailPoolEmailForRun'),
extractFunction('getCustomMailProviderPool'),
@@ -122,3 +123,18 @@ test('background selects the matching custom provider pool email for the current
assert.equal(api.getCustomMailProviderPoolEmailForRun(state, 3), 'third@example.com');
assert.equal(api.getCustomMailProviderPoolEmailForRun(state, 4), '');
});
test('background derives active custom email pool from structured entries', () => {
const api = createApi();
const state = {
customEmailPoolEntries: [
{ id: 'a', email: 'one@example.com', enabled: true, used: false },
{ id: 'b', email: 'two@example.com', enabled: true, used: true },
{ id: 'c', email: 'three@example.com', enabled: false, used: false },
],
};
assert.deepEqual(api.getCustomEmailPool(state), ['one@example.com']);
assert.equal(api.getCustomEmailPoolEmailForRun(state, 1), 'one@example.com');
assert.equal(api.getCustomEmailPoolEmailForRun(state, 2), '');
});
@@ -57,6 +57,9 @@ test('sidepanel html exposes custom email pool generator option and input row',
assert.match(html, /option value="custom-pool">自定义邮箱池<\/option>/);
assert.match(html, /id="row-custom-email-pool"/);
assert.match(html, /id="input-custom-email-pool"/);
assert.match(html, /id="input-custom-email-pool-import"/);
assert.match(html, /id="custom-email-pool-list"/);
assert.match(html, /id="btn-custom-email-pool-bulk-used"/);
assert.match(html, /id="row-custom-mail-provider-pool"/);
assert.match(html, /id="input-custom-mail-provider-pool"/);
});