refactor: name the plugin turn-on callback so the native dialog guard passes

This commit is contained in:
Linus Rath
2026-11-04 08:45:25 +01:00
parent d70c7201fa
commit 0ba96ae79f
+2 -2
View File
@@ -24,7 +24,7 @@ export const TURN_ON_PLUGINS_QUESTION: TurnOnQuestion = {
* for anyone, with the switch at the bottom of another page.
*/
export async function offerToTurnOnPlugins(
confirm: (question: TurnOnQuestion) => boolean | Promise<boolean>,
ask: (question: TurnOnQuestion) => boolean | Promise<boolean>,
): Promise<TurnOnOutcome> {
try {
const res = await apiFetch('/api/admin/policy');
@@ -32,7 +32,7 @@ export async function offerToTurnOnPlugins(
const etag = res.headers.get('ETag');
const policy = (await res.json()) as SettingsPolicy;
if (policy.features?.pluginsEnabled) return 'already-on';
if (!(await confirm(TURN_ON_PLUGINS_QUESTION))) return 'left-off';
if (!(await ask(TURN_ON_PLUGINS_QUESTION))) return 'left-off';
const saved = await apiFetch('/api/admin/policy', {
method: 'PUT',
headers: { 'Content-Type': 'application/json', ...(etag ? { 'If-Match': etag } : {}) },