mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-11-05 08:16:22 +00:00
refactor: name the plugin turn-on callback so the native dialog guard passes
This commit is contained in:
@@ -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 } : {}) },
|
||||
|
||||
Reference in New Issue
Block a user