Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-22 09:20:29 +01:00
FIX: handle non-logged in user trying to skip wizard (#154)
* FIX: handle non-logged in user trying to skip wizard * update version, fixed formatting * make sure skipping user is logged in
Dieser Commit ist enthalten in:
Ursprung
b9b80ecc63
Commit
51dbf7ac40
3 geänderte Dateien mit 13 neuen und 7 gelöschten Zeilen
|
@ -2,6 +2,7 @@ import { default as computed } from "discourse-common/utils/decorators";
|
||||||
import getUrl from "discourse-common/lib/get-url";
|
import getUrl from "discourse-common/lib/get-url";
|
||||||
import WizardField from "wizard/models/wizard-field";
|
import WizardField from "wizard/models/wizard-field";
|
||||||
import { ajax } from "wizard/lib/ajax";
|
import { ajax } from "wizard/lib/ajax";
|
||||||
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||||
import Step from "wizard/models/step";
|
import Step from "wizard/models/step";
|
||||||
import EmberObject from "@ember/object";
|
import EmberObject from "@ember/object";
|
||||||
import Site from "./site";
|
import Site from "./site";
|
||||||
|
@ -24,15 +25,19 @@ const CustomWizard = EmberObject.extend({
|
||||||
|
|
||||||
CustomWizard.reopenClass({
|
CustomWizard.reopenClass({
|
||||||
skip(wizardId) {
|
skip(wizardId) {
|
||||||
ajax({ url: `/w/${wizardId}/skip`, type: "PUT" }).then((result) => {
|
ajax({ url: `/w/${wizardId}/skip`, type: "PUT" })
|
||||||
CustomWizard.finished(result);
|
.then((result) => {
|
||||||
});
|
CustomWizard.finished(result);
|
||||||
|
})
|
||||||
|
.catch(popupAjaxError);
|
||||||
},
|
},
|
||||||
|
|
||||||
restart(wizardId) {
|
restart(wizardId) {
|
||||||
ajax({ url: `/w/${wizardId}/skip`, type: "PUT" }).then(() => {
|
ajax({ url: `/w/${wizardId}/skip`, type: "PUT" })
|
||||||
window.location.href = `/w/${wizardId}`;
|
.then(() => {
|
||||||
});
|
window.location.href = `/w/${wizardId}`;
|
||||||
|
})
|
||||||
|
.catch(popupAjaxError);
|
||||||
},
|
},
|
||||||
|
|
||||||
finished(result) {
|
finished(result) {
|
||||||
|
|
|
@ -5,6 +5,7 @@ class CustomWizard::WizardController < ::ApplicationController
|
||||||
layout 'wizard'
|
layout 'wizard'
|
||||||
|
|
||||||
before_action :ensure_plugin_enabled
|
before_action :ensure_plugin_enabled
|
||||||
|
before_action :ensure_logged_in, only: [:skip]
|
||||||
helper_method :wizard_page_title
|
helper_method :wizard_page_title
|
||||||
helper_method :wizard_theme_id
|
helper_method :wizard_theme_id
|
||||||
helper_method :wizard_theme_lookup
|
helper_method :wizard_theme_lookup
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
# name: discourse-custom-wizard
|
# name: discourse-custom-wizard
|
||||||
# about: Create custom wizards
|
# about: Create custom wizards
|
||||||
# version: 1.15.2
|
# version: 1.15.3
|
||||||
# authors: Angus McLeod
|
# authors: Angus McLeod
|
||||||
# url: https://github.com/paviliondev/discourse-custom-wizard
|
# url: https://github.com/paviliondev/discourse-custom-wizard
|
||||||
# contact emails: angus@thepavilion.io
|
# contact emails: angus@thepavilion.io
|
||||||
|
|
Laden …
In neuem Issue referenzieren