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

Function setLuckmailPurchasePreservedState

background.js:2397–2419  ·  view source on GitHub ↗
(purchaseId, preserved)

Source from the content-addressed store, hash-verified

2395}
2396
2397async function setLuckmailPurchasePreservedState(purchaseId, preserved) {
2398 const state = await ensureManualInteractionAllowed('设置 LuckMail 邮箱保留状态');
2399 const client = createLuckmailClient(state);
2400 const purchase = await getLuckmailPurchaseById(state, purchaseId, {
2401 client,
2402 projectCode: DEFAULT_LUCKMAIL_PROJECT_CODE,
2403 });
2404
2405 if (preserved) {
2406 const preserveTag = await ensureLuckmailPreserveTag(client, state);
2407 await client.user.setPurchaseTag(purchase.id, { tagId: preserveTag.id });
2408 } else {
2409 await client.user.setPurchaseTag(purchase.id, { tagId: 0 });
2410 }
2411
2412 await addLog(`LuckMail:已将 ${purchase.email_address} ${preserved ? '设为保留' : '取消保留'}`, 'ok');
2413 const refreshedState = await getState();
2414 const refreshedPurchase = await getLuckmailPurchaseById(refreshedState, purchase.id, {
2415 client,
2416 projectCode: DEFAULT_LUCKMAIL_PROJECT_CODE,
2417 });
2418 return buildLuckmailPurchaseView(refreshedPurchase, await getState());
2419}
2420
2421async function setLuckmailPurchaseDisabledState(purchaseId, disabled) {
2422 const state = await ensureManualInteractionAllowed(disabled ? '禁用 LuckMail 邮箱' : '启用 LuckMail 邮箱');

Callers 1

handleMessageFunction · 0.85

Calls 7

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

Tested by

no test coverage detected