fix(accounts): unlock parent provider when enabling rows
Make individual Debrid-Link and Mega-Debrid switches express an explicit enabled target. Enabling a row now clears both its own disabled identifier and the effective provider lock; Mega-Debrid also re-enables the selected API or web mode. Keep row-level disabling scoped to the selected account, align the legacy key view with the effective provider state, and cover the provider-plus-account lock combination with a regression test.
This commit is contained in:
@@ -89,6 +89,24 @@ export async function runOptimisticAccountUpdate<T>(
|
||||
}
|
||||
}
|
||||
|
||||
export function buildScopedAccountEnabledState(
|
||||
currentDisabledProviders: DebridProvider[],
|
||||
providerIds: DebridProvider[],
|
||||
currentDisabledAccountIds: string[],
|
||||
accountId: string,
|
||||
enabled: boolean
|
||||
): { disabledProviders: DebridProvider[]; disabledAccountIds: string[] } {
|
||||
const providers = new Set(providerIds);
|
||||
return {
|
||||
disabledProviders: enabled
|
||||
? currentDisabledProviders.filter((provider) => !providers.has(provider))
|
||||
: [...currentDisabledProviders],
|
||||
disabledAccountIds: enabled
|
||||
? currentDisabledAccountIds.filter((id) => id !== accountId)
|
||||
: [...new Set([...currentDisabledAccountIds, accountId])]
|
||||
};
|
||||
}
|
||||
|
||||
export function buildBulkAccountEnabledState(
|
||||
currentDisabledProviders: DebridProvider[],
|
||||
configuredProviders: DebridProvider[],
|
||||
|
||||
Reference in New Issue
Block a user