MCPcopy Index your code
hub / github.com/QLHazyCoder/FlowPilot / setLuckmailPurchaseDisabledState

Function setLuckmailPurchaseDisabledState

background.js:2421–2443  ·  view source on GitHub ↗
(purchaseId, disabled)

Source from the content-addressed store, hash-verified

2419}
2420
2421async function setLuckmailPurchaseDisabledState(purchaseId, disabled) {
2422 const state = await ensureManualInteractionAllowed(disabled ? '禁用 LuckMail 邮箱' : '启用 LuckMail 邮箱');
2423 const client = createLuckmailClient(state);
2424 const purchase = await getLuckmailPurchaseById(state, purchaseId, {
2425 client,
2426 projectCode: DEFAULT_LUCKMAIL_PROJECT_CODE,
2427 });
2428
2429 await client.user.setPurchaseDisabled(purchase.id, disabled ? 1 : 0);
2430
2431 const currentPurchase = getCurrentLuckmailPurchase(await getState());
2432 if (disabled && currentPurchase?.id === purchase.id) {
2433 await clearLuckmailRuntimeState({ clearEmail: isLuckmailProvider(await getState()) });
2434 }
2435
2436 await addLog(`LuckMail:已将 ${purchase.email_address} ${disabled ? '禁用' : '启用'}`, 'ok');
2437 const refreshedState = await getState();
2438 const refreshedPurchase = await getLuckmailPurchaseById(refreshedState, purchase.id, {
2439 client,
2440 projectCode: DEFAULT_LUCKMAIL_PROJECT_CODE,
2441 });
2442 return buildLuckmailPurchaseView(refreshedPurchase, await getState());
2443}
2444
2445async function batchUpdateLuckmailPurchases(input = {}) {
2446 const action = String(input.action || '').trim();

Callers 1

handleMessageFunction · 0.85

Calls 9

createLuckmailClientFunction · 0.85
getLuckmailPurchaseByIdFunction · 0.85
getStateFunction · 0.85
isLuckmailProviderFunction · 0.70
addLogFunction · 0.70

Tested by

no test coverage detected