diff --git a/assets/javascripts/wizard/models/custom.js.es6 b/assets/javascripts/wizard/models/custom.js.es6 index a8439db1..0e7c557f 100644 --- a/assets/javascripts/wizard/models/custom.js.es6 +++ b/assets/javascripts/wizard/models/custom.js.es6 @@ -2,6 +2,7 @@ import { default as computed } from "discourse-common/utils/decorators"; import getUrl from "discourse-common/lib/get-url"; import WizardField from "wizard/models/wizard-field"; import { ajax } from "wizard/lib/ajax"; +import { popupAjaxError } from "discourse/lib/ajax-error"; import Step from "wizard/models/step"; import EmberObject from "@ember/object"; import Site from "./site"; @@ -24,15 +25,19 @@ const CustomWizard = EmberObject.extend({ CustomWizard.reopenClass({ skip(wizardId) { - ajax({ url: `/w/${wizardId}/skip`, type: "PUT" }).then((result) => { - CustomWizard.finished(result); - }); + ajax({ url: `/w/${wizardId}/skip`, type: "PUT" }) + .then((result) => { + CustomWizard.finished(result); + }) + .catch(popupAjaxError); }, restart(wizardId) { - ajax({ url: `/w/${wizardId}/skip`, type: "PUT" }).then(() => { - window.location.href = `/w/${wizardId}`; - }); + ajax({ url: `/w/${wizardId}/skip`, type: "PUT" }) + .then(() => { + window.location.href = `/w/${wizardId}`; + }) + .catch(popupAjaxError); }, finished(result) { diff --git a/controllers/custom_wizard/wizard.rb b/controllers/custom_wizard/wizard.rb index 7125fc8a..99add54d 100644 --- a/controllers/custom_wizard/wizard.rb +++ b/controllers/custom_wizard/wizard.rb @@ -5,6 +5,7 @@ class CustomWizard::WizardController < ::ApplicationController layout 'wizard' before_action :ensure_plugin_enabled + before_action :ensure_logged_in, only: [:skip] helper_method :wizard_page_title helper_method :wizard_theme_id helper_method :wizard_theme_lookup diff --git a/plugin.rb b/plugin.rb index da28bd3e..b4d09421 100644 --- a/plugin.rb +++ b/plugin.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # name: discourse-custom-wizard # about: Create custom wizards -# version: 1.15.2 +# version: 1.15.3 # authors: Angus McLeod # url: https://github.com/paviliondev/discourse-custom-wizard # contact emails: angus@thepavilion.io