diff --git a/packages/insomnia-app/app/plugins/context/app.js b/packages/insomnia-app/app/plugins/context/app.js index 343803593..f1e95ed42 100644 --- a/packages/insomnia-app/app/plugins/context/app.js +++ b/packages/insomnia-app/app/plugins/context/app.js @@ -10,16 +10,22 @@ import { import WrapperModal from '../../ui/components/modals/wrapper-modal'; export function init(renderPurpose: RenderPurpose = RENDER_PURPOSE_GENERAL): { app: Object } { + const canShowDialogs = + renderPurpose === RENDER_PURPOSE_SEND || renderPurpose === RENDER_PURPOSE_NO_RENDER; return { app: { alert(title: string, message?: string): Promise { - if (renderPurpose !== RENDER_PURPOSE_SEND && renderPurpose !== RENDER_PURPOSE_NO_RENDER) { + if (!canShowDialogs) { return Promise.resolve(); } return showAlert({ title, message }); }, showGenericModalDialog(title: string, options?: { html: string } = {}): Promise { + if (renderPurpose !== RENDER_PURPOSE_SEND && renderPurpose !== RENDER_PURPOSE_NO_RENDER) { + return Promise.resolve(); + } + return showModal(WrapperModal, { title, bodyHTML: options.html }); }, prompt( @@ -33,7 +39,7 @@ export function init(renderPurpose: RenderPurpose = RENDER_PURPOSE_GENERAL): { a ): Promise { options = options || {}; - if (renderPurpose !== RENDER_PURPOSE_SEND) { + if (!canShowDialogs) { return Promise.resolve(options.defaultValue || ''); } @@ -59,7 +65,7 @@ export function init(renderPurpose: RenderPurpose = RENDER_PURPOSE_GENERAL): { a } }, async showSaveDialog(options: { defaultPath?: string } = {}): Promise { - if (renderPurpose !== RENDER_PURPOSE_SEND) { + if (!canShowDialogs) { return Promise.resolve(null); }