1
0
Fork 0

Commits vergleichen

..

62 Commits
stable ... main

Autor SHA1 Nachricht Datum
5fe63ec70e
test 2023-10-03 20:36:04 +02:00
6bc33ebd64
test 2023-10-03 20:25:00 +02:00
df456abda0
test3 2023-10-03 20:09:53 +02:00
df30ce32ee
test2 2023-10-03 19:54:15 +02:00
4750829e1a
testing 2023-10-03 19:35:16 +02:00
49535d88bb
set default type to business 2023-10-03 18:44:50 +02:00
Angus McLeod
d5aa616ff8 DEV: Add explicit ordering to more specs 2023-09-30 09:46:25 +08:00
Angus McLeod
578c92e90e
Merge pull request #269 from paviliondev/composer-control-feature
Composer control feature
2023-09-21 10:43:24 +10:00
jumagura
3d104406fd REFACTOR: Improve test for category chooser when there is a create_topic_wizard customfield 2023-09-20 03:55:32 -04:00
jumagura
0eb6fb1ae0 REFACTOR: Move before_create_topic event handler to plugin.rb 2023-09-19 20:46:42 -04:00
jumagura
0992e9601c DEV: Make hide category default when custom wizard is selected 2023-09-19 14:17:06 -04:00
jumagura
10609f33e2 FIX: linting error 2023-09-19 14:00:04 -04:00
jumagura
bb81c5700a DEV: Use Discourse Events instead of topic model 2023-09-19 13:57:11 -04:00
jumagura
03ef41f7f0 FIX: Linting error 2023-09-18 18:11:20 -04:00
jumagura
bdd290f4e6 FIX: Linting error 2023-09-18 18:07:27 -04:00
jumagura
2ab15aaf86 FIX: linting error 2023-09-18 18:06:52 -04:00
jumagura
de9dccf233 bump version 2023-09-18 17:46:41 -04:00
jumagura
bb3f0c6252 DEV: Add acceptance tests for category filtering 2023-09-18 17:41:24 -04:00
jumagura
61309fd320 DEV: Add initializer logic to filter categories 2023-09-18 17:40:44 -04:00
jumagura
b365b5dd4f DEV: Add custom_field 2023-09-18 17:40:07 -04:00
jumagura
de03cbd15a DEV: Implement control to hide category from composer dropdown in specified categories 2023-09-18 17:39:50 -04:00
jumagura
29d7818a4a DEV: Add spec for validation 2023-09-18 17:36:21 -04:00
jumagura
f2d1437cff DEV: Implement wizard replacement validation in Topic Creation 2023-09-18 17:35:38 -04:00
Angus McLeod
9ab4ca21c8
Merge pull request #268 from paviliondev/fix_export_size
FIX: avoid page limit on downloads
2023-09-16 16:03:15 +10:00
merefield
16109b01e7 bump patch 2023-09-15 16:19:09 +01:00
merefield
43cd090b17 FIX: avoid page limit on downloads 2023-09-15 16:15:31 +01:00
Angus McLeod
5f99dc226a
Merge pull request #267 from paviliondev/resolve_deprecations
COMPATIBILITY:  resolve deprecations expected in Ember upgrade for Discourse 3.2
2023-09-15 16:55:45 +10:00
merefield
2460685e65 remove unintentional comment 2023-09-15 07:04:17 +01:00
merefield
c6fded7113 fix disabled behaviour of start time button 2023-09-14 21:08:20 +01:00
merefield
713c1bcaa5 fix test 2023-09-14 20:47:05 +01:00
merefield
ffa37e895c fix test and test spelling 2023-09-14 20:35:30 +01:00
merefield
22fac139b6 linting 2023-09-14 20:08:10 +01:00
merefield
61ea75dcad remove debugger statement 2023-09-14 20:03:02 +01:00
merefield
766d3b5fc9 fix erroneous route transitions 2023-09-14 20:02:02 +01:00
merefield
a786b5956b linting 2023-09-14 19:21:10 +01:00
merefield
794b7c9d5c add missing I18n imports 2023-09-14 19:19:20 +01:00
merefield
76c359be3b linting 2023-09-14 19:16:59 +01:00
merefield
6572b32706 move modals to glimmer components 2023-09-14 19:14:44 +01:00
merefield
d71d9976b8 bump patch 2023-09-14 15:05:54 +01:00
merefield
27596a1624 linting 2023-09-14 15:03:15 +01:00
merefield
3c17ef574e linting 2023-09-14 14:59:22 +01:00
merefield
742239b023 add router service to controllers to avoid deprecation 2023-09-14 14:58:34 +01:00
merefield
33a320021f linting 2023-09-14 14:47:52 +01:00
merefield
e6f44b7dfc resolve a batch of router deprecations 2023-09-14 14:42:12 +01:00
merefield
31f917ec80 fix replaceWith calling style deprecation 2023-09-14 14:34:18 +01:00
merefield
6c0d7a671e more this additions 2023-09-14 14:18:47 +01:00
merefield
31b2625a65 add this to avoid deprecation 2023-09-14 14:05:55 +01:00
Robert
bce0acbfd2
Merge pull request #263 from paviliondev/update-compatibility-main
DEV: Pin plugin for Discourse 3.1 stable
2023-09-08 16:31:17 +01:00
Robert
b81bc762c7
Merge branch 'main' into update-compatibility-main 2023-09-08 16:21:00 +01:00
jumagura
785bce228e bump version 2023-09-08 10:02:12 -04:00
Angus McLeod
52efc15576
Merge pull request #265 from paviliondev/temp_ignore_redirect
FEATURE: implement a way to temporarily ignore redirect
2023-09-08 09:53:12 +02:00
merefield
ebc0f706e3 remove redundant assignment 2023-09-08 07:18:31 +01:00
merefield
050a38a9d3 make code testable, add test 2023-09-08 07:13:52 +01:00
merefield
8649ab2286 bump patch 2023-09-06 16:27:40 +01:00
merefield
037132fb1a prettier 2023-09-06 16:26:30 +01:00
merefield
8332818616 FEATURE: implement way to temporarily ignore redirect 2023-09-06 13:29:21 +01:00
jumagura
36d6f9bc6f bump version 2023-09-05 12:52:11 -04:00
jumagura
121d60330a DEV: Pin plugin for Discourse 3.1 stable 2023-09-05 12:49:58 -04:00
jumagura
13a1538eb9 DEV: Update compatibility for main branch 2023-09-05 12:38:25 -04:00
Angus McLeod
fee56c2d43
Merge pull request #261 from paviliondev/fix_submissions_data_export_content
SECURITY: remove sensitive user content from submissions export
2023-08-23 17:50:10 +02:00
merefield
da4fe79aea bump patch 2023-08-23 14:35:58 +01:00
merefield
0a450d58f4 SECURITY: remove sensitive user content from submissions export 2023-08-23 14:33:56 +01:00
40 geänderte Dateien mit 443 neuen und 250 gelöschten Zeilen

Datei anzeigen

@ -22,7 +22,12 @@ class CustomWizard::AdminSubmissionsController < CustomWizard::AdminController
end
def download
send_data submission_list.submissions.to_json,
content = ActiveModel::ArraySerializer.new(
CustomWizard::Submission.list(@wizard).submissions,
each_serializer: CustomWizard::SubmissionSerializer
)
send_data content.to_json,
filename: "#{Discourse.current_hostname}-wizard-submissions-#{@wizard.name}.json",
content_type: "application/json",
disposition: "attachment"

Datei anzeigen

@ -12,12 +12,14 @@ import { alias } from "@ember/object/computed";
import Site from "discourse/models/site";
import { uploadIcon } from "discourse/lib/uploads";
import { dasherize } from "@ember/string";
import showModal from "discourse/lib/show-modal";
import InsertHyperlink from "discourse/components/modal/insert-hyperlink";
import { inject as service } from "@ember/service";
const IMAGE_MARKDOWN_REGEX =
/!\[(.*?)\|(\d{1,4}x\d{1,4})(,\s*\d{1,3}%)?(.*?)\]\((upload:\/\/.*?)\)(?!(.*`))/g;
export default ComposerEditor.extend({
modal: service(),
classNameBindings: ["fieldClass"],
allowUpload: true,
@ -198,9 +200,8 @@ export default ComposerEditor.extend({
if (this._lastSel) {
linkText = this._lastSel.value;
}
showModal("insert-hyperlink").setProperties({
linkText,
toolbarEvent,
this.modal.show(InsertHyperlink, {
model: { linkText, toolbarEvent },
});
},

Datei anzeigen

@ -0,0 +1,34 @@
<DModal @closeModal={{@closeModal}} @title={{this.title}}>
{{#if loading}}
<LoadingSpinner size="large" />
{{else}}
<div class="edit-directory-columns-container">
{{#each @model.columns as |column|}}
<div class="edit-directory-column">
<div class="left-content">
<label class="column-name">
<Input @type="checkbox" @checked={{column.enabled}} />
{{directory-table-header-title
field=column.label
translated=true
}}
</label>
</div>
</div>
{{/each}}
</div>
{{/if}}
<div class="modal-footer">
<DButton
class="btn-primary"
@label="directory.edit_columns.save"
@action={{action "save"}}
/>
<DButton
class="btn-secondary reset-to-default"
@label="directory.edit_columns.reset_to_default"
@action={{action "resetToDefault"}}
/>
</div>
</DModal>

Datei anzeigen

@ -0,0 +1,15 @@
import Component from "@glimmer/component";
import { action } from "@ember/object";
import I18n from "I18n";
export default class AdminWizardsColumnComponent extends Component {
title = I18n.t("admin.wizard.edit_columns");
@action save() {
this.args.closeModal();
}
@action resetToDefault() {
this.args.model.reset();
}
}

Datei anzeigen

@ -0,0 +1,20 @@
<DModal
@closeModal={{@closeModal}}
class="next-session-time-modal"
@title={{this.title}}
>
<DateTimeInput
@date={{this.bufferedDateTime}}
@onChange={{action "dateTimeChanged"}}
@showTime="true"
@clearable="true"
/>
<div class="modal-footer">
<DButton
@action={{action "submit"}}
class="btn-primary"
@label="admin.wizard.after_time_modal.done"
@disabled={{this.submitDisabled}}
/>
</div>
</DModal>

Datei anzeigen

@ -0,0 +1,30 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
import I18n from "I18n";
export default class NextSessionScheduledComponent extends Component {
@tracked bufferedDateTime;
title = I18n.t("admin.wizard.after_time_modal.title");
constructor() {
super(...arguments);
this.bufferedDateTime = this.args.model.dateTime
? moment(this.args.model.dateTime)
: moment(Date.now());
}
get submitDisabled() {
return moment().isAfter(this.bufferedDateTime);
}
@action submit() {
const dateTime = this.bufferedDateTime;
this.args.model.update(moment(dateTime).utc().toISOString());
this.args.closeModal();
}
@action dateTimeChanged(dateTime) {
this.bufferedDateTime = dateTime;
}
}

Datei anzeigen

@ -7,8 +7,11 @@ import { selectKitContent } from "../lib/wizard";
import { underscore } from "@ember/string";
import Controller from "@ember/controller";
import I18n from "I18n";
import { inject as service } from "@ember/service";
export default Controller.extend({
router: service(),
queryParams: ["refresh_list"],
loadingSubscriptions: false,
notAuthorized: not("api.authorized"),
@ -248,7 +251,7 @@ export default Controller.extend({
.catch(popupAjaxError)
.then((result) => {
if (result.success) {
this.transitionToRoute("adminWizardsApis").then(() => {
this.router.transitionTo("adminWizardsApis").then(() => {
this.send("refreshModel");
});
}

Datei anzeigen

@ -1,14 +0,0 @@
import Controller from "@ember/controller";
import ModalFunctionality from "discourse/mixins/modal-functionality";
export default Controller.extend(ModalFunctionality, {
actions: {
save() {
this.send("closeModal");
},
resetToDefault() {
this.get("model.reset")();
},
},
});

Datei anzeigen

@ -2,11 +2,13 @@ import Controller from "@ember/controller";
import { empty } from "@ember/object/computed";
import discourseComputed from "discourse-common/utils/decorators";
import { fmt } from "discourse/lib/computed";
import showModal from "discourse/lib/show-modal";
import { inject as service } from "@ember/service";
import AdminWizardsColumnsModal from "../components/modal/admin-wizards-columns";
import CustomWizardAdmin from "../models/custom-wizard-admin";
import { formatModel } from "../lib/wizard-submission";
export default Controller.extend({
modal: service(),
downloadUrl: fmt("wizard.id", "/admin/wizards/submissions/%@/download"),
noResults: empty("submissions"),
page: 0,
@ -57,7 +59,7 @@ export default Controller.extend({
},
showEditColumnsModal() {
return showModal("admin-wizards-columns", {
return this.modal.show(AdminWizardsColumnsModal, {
model: {
columns: this.get("fields"),
reset: () => {

Datei anzeigen

@ -3,7 +3,8 @@ import {
observes,
} from "discourse-common/utils/decorators";
import { notEmpty } from "@ember/object/computed";
import showModal from "discourse/lib/show-modal";
import { inject as service } from "@ember/service";
import NextSessionScheduledModal from "../components/modal/next-session-scheduled";
import { generateId, wizardFieldList } from "../lib/wizard";
import { dasherize } from "@ember/string";
import { later, scheduleOnce } from "@ember/runloop";
@ -13,6 +14,7 @@ import I18n from "I18n";
import { filterValues } from "discourse/plugins/discourse-custom-wizard/discourse/lib/wizard-schema";
export default Controller.extend({
modal: service(),
hasName: notEmpty("wizard.name"),
@observes("currentStep")
@ -126,15 +128,13 @@ export default Controller.extend({
},
setNextSessionScheduled() {
let controller = showModal("next-session-scheduled", {
this.modal.show(NextSessionScheduledModal, {
model: {
dateTime: this.wizard.after_time_scheduled,
update: (dateTime) =>
this.set("wizard.after_time_scheduled", dateTime),
},
});
controller.setup();
},
copyUrl() {

Datei anzeigen

@ -1,7 +1,9 @@
import Controller from "@ember/controller";
import getUrl from "discourse-common/lib/get-url";
import { inject as service } from "@ember/service";
export default Controller.extend({
router: service(),
wizard: null,
step: null,
@ -15,12 +17,12 @@ export default Controller.extend({
const wizardId = this.get("wizard.id");
window.location.href = getUrl(`/w/${wizardId}/steps/${nextStepId}`);
} else {
this.transitionToRoute("customWizardStep", nextStepId);
this.router.transitionTo("customWizardStep", nextStepId);
}
},
goBack() {
this.transitionToRoute("customWizardStep", this.get("step.previous"));
this.router.transitionTo("customWizardStep", this.get("step.previous"));
},
showMessage(message) {

Datei anzeigen

@ -1,30 +0,0 @@
import { default as discourseComputed } from "discourse-common/utils/decorators";
import Controller from "@ember/controller";
export default Controller.extend({
title: "admin.wizard.after_time_modal.title",
setup() {
this.set(
"bufferedDateTime",
this.model.dateTime ? moment(this.model.dateTime) : moment(Date.now())
);
},
@discourseComputed("bufferedDateTime")
submitDisabled(dateTime) {
return moment().isAfter(dateTime);
},
actions: {
submit() {
const dateTime = this.get("bufferedDateTime");
this.get("model.update")(moment(dateTime).utc().toISOString());
this.send("closeModal");
},
dateTimeChanged(dateTime) {
this.set("bufferedDateTime", dateTime);
},
},
});

Datei anzeigen

@ -83,6 +83,16 @@ export default {
}
},
});
api.modifyClass("component:category-chooser", {
categoriesByScope(options = {}) {
let categories = this._super(options);
return categories.filter((category) => {
return !category.custom_fields?.create_topic_wizard;
});
},
});
});
},
};

Datei anzeigen

@ -30,6 +30,7 @@ export default {
.concat(["loading"]);
if (
redirectToWizard &&
!data.url.includes("ignore_redirect") &&
data.currentRouteName !== "customWizardStep" &&
!excludedPaths.find((p) => {
return data.currentRouteName.indexOf(p) > -1;

Datei anzeigen

@ -1,7 +1,10 @@
import CustomWizardApi from "../models/custom-wizard-api";
import DiscourseRoute from "discourse/routes/discourse";
import { inject as service } from "@ember/service";
export default DiscourseRoute.extend({
router: service(),
model(params) {
if (params.name === "create") {
return CustomWizardApi.create({ isNew: true });
@ -12,7 +15,7 @@ export default DiscourseRoute.extend({
afterModel(model) {
if (model === null) {
return this.transitionTo("adminWizardsApi");
return this.router.transitionTo("adminWizardsApi");
}
},

Datei anzeigen

@ -1,7 +1,10 @@
import DiscourseRoute from "discourse/routes/discourse";
import CustomWizardApi from "../models/custom-wizard-api";
import { inject as service } from "@ember/service";
export default DiscourseRoute.extend({
router: service(),
model() {
return CustomWizardApi.list();
},
@ -25,11 +28,11 @@ export default DiscourseRoute.extend({
actions: {
changeApi(apiName) {
this.controllerFor("adminWizardsApi").set("apiName", apiName);
this.transitionTo("adminWizardsApiShow", apiName);
this.router.transitionTo("adminWizardsApiShow", apiName);
},
afterDestroy() {
this.transitionTo("adminWizardsApi").then(() => this.refresh());
this.router.transitionTo("adminWizardsApi").then(() => this.refresh());
},
afterSave(apiName) {
@ -38,7 +41,7 @@ export default DiscourseRoute.extend({
createApi() {
this.controllerFor("adminWizardsApi").set("apiName", "create");
this.transitionTo("adminWizardsApiShow", "create");
this.router.transitionTo("adminWizardsApiShow", "create");
},
},
});

Datei anzeigen

@ -1,15 +1,18 @@
import CustomWizardLogs from "../models/custom-wizard-logs";
import DiscourseRoute from "discourse/routes/discourse";
import { A } from "@ember/array";
import { inject as service } from "@ember/service";
export default DiscourseRoute.extend({
router: service(),
model(params) {
return CustomWizardLogs.list(params.wizardId);
},
afterModel(model) {
if (model === null) {
return this.transitionTo("adminWizardsLogs");
return this.router.transitionTo("adminWizardsLogs");
}
},

Datei anzeigen

@ -1,7 +1,10 @@
import DiscourseRoute from "discourse/routes/discourse";
import { ajax } from "discourse/lib/ajax";
import { inject as service } from "@ember/service";
export default DiscourseRoute.extend({
router: service(),
model() {
return ajax(`/admin/wizards/wizard`);
},
@ -18,7 +21,7 @@ export default DiscourseRoute.extend({
actions: {
changeWizard(wizardId) {
this.controllerFor("adminWizardsLogs").set("wizardId", wizardId);
this.transitionTo("adminWizardsLogsShow", wizardId);
this.router.transitionTo("adminWizardsLogsShow", wizardId);
},
},
});

Datei anzeigen

@ -2,15 +2,18 @@ import { A } from "@ember/array";
import CustomWizardAdmin from "../models/custom-wizard-admin";
import DiscourseRoute from "discourse/routes/discourse";
import { formatModel } from "../lib/wizard-submission";
import { inject as service } from "@ember/service";
export default DiscourseRoute.extend({
router: service(),
model(params) {
return CustomWizardAdmin.submissions(params.wizardId);
},
afterModel(model) {
if (model === null) {
return this.transitionTo("adminWizardsSubmissions");
return this.router.transitionTo("adminWizardsSubmissions");
}
},

Datei anzeigen

@ -1,7 +1,10 @@
import DiscourseRoute from "discourse/routes/discourse";
import { ajax } from "discourse/lib/ajax";
import { inject as service } from "@ember/service";
export default DiscourseRoute.extend({
router: service(),
model() {
return ajax(`/admin/wizards/wizard`);
},
@ -18,7 +21,7 @@ export default DiscourseRoute.extend({
actions: {
changeWizard(wizardId) {
this.controllerFor("adminWizardsSubmissions").set("wizardId", wizardId);
this.transitionTo("adminWizardsSubmissionsShow", wizardId);
this.router.transitionTo("adminWizardsSubmissionsShow", wizardId);
},
},
});

Datei anzeigen

@ -2,8 +2,11 @@ import CustomWizardAdmin from "../models/custom-wizard-admin";
import { ajax } from "discourse/lib/ajax";
import DiscourseRoute from "discourse/routes/discourse";
import I18n from "I18n";
import { inject as service } from "@ember/service";
export default DiscourseRoute.extend({
router: service(),
model(params) {
if (params.wizardId === "create") {
return { create: true };
@ -14,7 +17,7 @@ export default DiscourseRoute.extend({
afterModel(model) {
if (model.none) {
return this.transitionTo("adminWizardsWizard");
return this.router.transitionTo("adminWizardsWizard");
}
},

Datei anzeigen

@ -4,8 +4,11 @@ import EmberObject, { set } from "@ember/object";
import { A } from "@ember/array";
import { all } from "rsvp";
import { ajax } from "discourse/lib/ajax";
import { inject as service } from "@ember/service";
export default DiscourseRoute.extend({
router: service(),
model() {
return ajax("/admin/wizards/wizard");
},
@ -80,14 +83,14 @@ export default DiscourseRoute.extend({
this.controllerFor("adminWizardsWizard").set("wizardId", wizardId);
if (wizardId) {
this.transitionTo("adminWizardsWizardShow", wizardId);
this.router.transitionTo("adminWizardsWizardShow", wizardId);
} else {
this.transitionTo("adminWizardsWizard");
this.router.transitionTo("adminWizardsWizard");
}
},
afterDestroy() {
this.transitionTo("adminWizardsWizard").then(() => this.refresh());
this.router.transitionTo("adminWizardsWizard").then(() => this.refresh());
},
afterSave(wizardId) {
@ -96,7 +99,7 @@ export default DiscourseRoute.extend({
createWizard() {
this.controllerFor("adminWizardsWizard").set("wizardId", "create");
this.transitionTo("adminWizardsWizardShow", "create");
this.router.transitionTo("adminWizardsWizardShow", "create");
},
},
});

Datei anzeigen

@ -1,7 +1,10 @@
import DiscourseRoute from "discourse/routes/discourse";
import { ajax } from "discourse/lib/ajax";
import { inject as service } from "@ember/service";
export default DiscourseRoute.extend({
router: service(),
model() {
return ajax("/admin/wizards");
},
@ -17,7 +20,7 @@ export default DiscourseRoute.extend({
afterModel(model, transition) {
if (transition.targetName === "adminWizards.index") {
this.transitionTo("adminWizardsWizard");
this.router.transitionTo("adminWizardsWizard");
}
},
});

Datei anzeigen

@ -1,11 +1,14 @@
import { getCachedWizard } from "../models/custom-wizard";
import Route from "@ember/routing/route";
import { inject as service } from "@ember/service";
export default Route.extend({
router: service(),
beforeModel() {
const wizard = getCachedWizard();
if (wizard && wizard.permitted && !wizard.completed && wizard.start) {
this.replaceWith("customWizardStep", wizard.start);
this.router.replaceWith("customWizardStep", wizard.start);
}
},

Datei anzeigen

@ -3,14 +3,17 @@ import { getCachedWizard } from "../models/custom-wizard";
import Route from "@ember/routing/route";
import { scrollTop } from "discourse/mixins/scroll-top";
import { action } from "@ember/object";
import { inject as service } from "@ember/service";
export default Route.extend({
router: service(),
beforeModel() {
const wizard = getCachedWizard();
this.set("wizard", wizard);
if (!wizard || !wizard.permitted || wizard.completed) {
this.replaceWith("customWizard");
this.router.replaceWith("customWizard");
}
},
@ -27,7 +30,7 @@ export default Route.extend({
afterModel(model) {
if (model.completed) {
return this.transitionTo("wizard.index");
return this.router.transitionTo("wizard.index");
}
return model.set("wizardId", this.wizard.id);
},

Datei anzeigen

@ -14,7 +14,7 @@
<div class="setting-value">
{{wizard-subscription-selector
value=action.type
value=this.action.type
feature="action"
attribute="type"
onChange=(action "changeType")
@ -31,9 +31,9 @@
<div class="setting-value">
{{combo-box
value=action.run_after
value=this.action.run_after
content=runAfterContent
onChange=(action (mut action.run_after))
onChange=(action (mut this.action.run_after))
}}
</div>
</div>
@ -48,7 +48,7 @@
<div class="setting-value">
{{wizard-mapper
inputs=action.title
inputs=this.action.title
property="title"
onUpdate=(action "mappedFieldUpdated")
options=(hash
@ -67,10 +67,10 @@
<div class="setting-value">
{{combo-box
value=action.post
value=this.action.post
content=wizardFields
nameProperty="label"
onChange=(action (mut action.post))
onChange=(action (mut this.action.post))
options=(hash
none="admin.wizard.selector.placeholder.wizard_field"
isDisabled=showPostBuilder
@ -84,7 +84,7 @@
</div>
</div>
{{#if action.post_builder}}
{{#if this.action.post_builder}}
<div class="setting full">
<div class="setting-label">
<label>{{i18n "admin.wizard.action.post_builder.label"}}</label>
@ -92,7 +92,7 @@
<div class="setting-value editor">
{{wizard-text-editor
value=action.post_template
value=this.action.post_template
wizardFields=wizardFields
}}
</div>
@ -108,7 +108,7 @@
<div class="setting-value">
{{wizard-mapper
inputs=action.category
inputs=this.action.category
property="category"
onUpdate=(action "mappedFieldUpdated")
options=(hash
@ -131,7 +131,7 @@
<div class="setting-value">
{{wizard-mapper
inputs=action.tags
inputs=this.action.tags
property="tags"
onUpdate=(action "mappedFieldUpdated")
options=(hash
@ -153,7 +153,7 @@
<div class="setting-value">
{{wizard-mapper
inputs=action.visible
inputs=this.action.visible
property="visible"
onUpdate=(action "mappedFieldUpdated")
options=(hash
@ -171,7 +171,7 @@
<div class="setting-value">
{{wizard-mapper
inputs=action.add_event
inputs=this.action.add_event
property="add_event"
onUpdate=(action "mappedFieldUpdated")
options=(hash wizardFieldSelection=true context="action")
@ -188,7 +188,7 @@
<div class="setting-value">
{{wizard-mapper
inputs=action.add_location
inputs=this.action.add_location
property="add_location"
onUpdate=(action "mappedFieldUpdated")
options=(hash wizardFieldSelection=true context="action")
@ -206,7 +206,7 @@
<div class="setting-value">
{{wizard-mapper
inputs=action.recipient
inputs=this.action.recipient
property="recipient"
onUpdate=(action "mappedFieldUpdated")
options=(hash
@ -230,7 +230,7 @@
</div>
{{wizard-mapper
inputs=action.profile_updates
inputs=this.action.profile_updates
property="profile_updates"
onUpdate=(action "mappedFieldUpdated")
options=(hash
@ -254,11 +254,11 @@
<div class="setting-value">
{{combo-box
value=action.api
value=this.action.api
content=availableApis
onChange=(action (mut action.api))
onChange=(action (mut this.action.api))
options=(hash
isDisabled=action.custom_title_enabled
isDisabled=this.action.custom_title_enabled
none="admin.wizard.action.send_to_api.select_an_api"
)
}}
@ -272,9 +272,9 @@
<div class="setting-value">
{{combo-box
value=action.api_endpoint
value=this.action.api_endpoint
content=availableEndpoints
onChange=(action (mut action.api_endpoint))
onChange=(action (mut this.action.api_endpoint))
options=(hash
isDisabled=apiEmpty
none="admin.wizard.action.send_to_api.select_an_endpoint"
@ -290,7 +290,7 @@
<div class="setting-value">
{{wizard-text-editor
value=action.api_body
value=this.action.api_body
previewEnabled=false
barEnabled=false
wizardFields=wizardFields
@ -308,7 +308,7 @@
<div class="setting-value">
{{wizard-mapper
inputs=action.group
inputs=this.action.group
property="group"
onUpdate=(action "mappedFieldUpdated")
options=(hash
@ -333,7 +333,7 @@
<div class="setting-value">
{{wizard-mapper
inputs=action.url
inputs=this.action.url
property="url"
onUpdate=(action "mappedFieldUpdated")
options=(hash
@ -357,7 +357,7 @@
<div class="setting-value">
{{wizard-mapper
inputs=action.categories
inputs=this.action.categories
property="categories"
onUpdate=(action "mappedFieldUpdated")
options=(hash
@ -381,7 +381,7 @@
<div class="setting-value">
{{wizard-mapper
inputs=action.mute_remainder
inputs=this.action.mute_remainder
property="mute_remainder"
onUpdate=(action "mappedFieldUpdated")
options=(hash
@ -402,11 +402,11 @@
<div class="setting-value">
{{combo-box
value=action.notification_level
value=this.action.notification_level
content=availableNotificationLevels
onChange=(action (mut action.notification_level))
onChange=(action (mut this.action.notification_level))
options=(hash
isDisabled=action.custom_title_enabled
isDisabled=this.action.custom_title_enabled
none="admin.wizard.action.watch_x.select_a_notification_level"
)
}}
@ -430,7 +430,7 @@
<div class="setting-value">
{{wizard-mapper
inputs=action.usernames
inputs=this.action.usernames
property="usernames"
onUpdate=(action "mappedFieldUpdated")
options=(hash
@ -452,7 +452,7 @@
<div class="setting-value">
{{wizard-mapper
inputs=action.tags
inputs=this.action.tags
property="tags"
onUpdate=(action "mappedFieldUpdated")
options=(hash
@ -476,11 +476,11 @@
<div class="setting-value">
{{combo-box
value=action.notification_level
value=this.action.notification_level
content=availableNotificationLevels
onChange=(action (mut action.notification_level))
onChange=(action (mut this.action.notification_level))
options=(hash
isDisabled=action.custom_title_enabled
isDisabled=this.action.custom_title_enabled
none="admin.wizard.action.watch_x.select_a_notification_level"
)
}}
@ -504,7 +504,7 @@
<div class="setting-value">
{{wizard-mapper
inputs=action.usernames
inputs=this.action.usernames
property="usernames"
onUpdate=(action "mappedFieldUpdated")
options=(hash
@ -526,7 +526,7 @@
<div class="setting-value">
{{wizard-mapper
inputs=action.name
inputs=this.action.name
property="name"
onUpdate=(action "mappedFieldUpdated")
options=(hash
@ -545,7 +545,7 @@
<div class="setting-value">
{{wizard-mapper
inputs=action.full_name
inputs=this.action.full_name
property="full_name"
onUpdate=(action "mappedFieldUpdated")
options=(hash
@ -564,7 +564,7 @@
<div class="setting-value">
{{wizard-mapper
inputs=action.title
inputs=this.action.title
property="title"
onUpdate=(action "mappedFieldUpdated")
options=(hash
@ -583,7 +583,7 @@
<div class="setting-value">
{{wizard-mapper
inputs=action.bio_raw
inputs=this.action.bio_raw
property="bio_raw"
onUpdate=(action "mappedFieldUpdated")
options=(hash
@ -602,7 +602,7 @@
<div class="setting-value">
{{wizard-mapper
inputs=action.owner_usernames
inputs=this.action.owner_usernames
property="owner_usernames"
onUpdate=(action "mappedFieldUpdated")
options=(hash
@ -622,7 +622,7 @@
<div class="setting-value">
{{wizard-mapper
inputs=action.usernames
inputs=this.action.usernames
property="usernames"
onUpdate=(action "mappedFieldUpdated")
options=(hash
@ -644,7 +644,7 @@
<div class="setting-value">
{{wizard-mapper
inputs=action.grant_trust_level
inputs=this.action.grant_trust_level
property="grant_trust_level"
onUpdate=(action "mappedFieldUpdated")
options=(hash
@ -665,7 +665,7 @@
<div class="setting-value">
{{wizard-mapper
inputs=action.mentionable_level
inputs=this.action.mentionable_level
property="mentionable_level"
onUpdate=(action "mappedFieldUpdated")
options=(hash
@ -686,7 +686,7 @@
<div class="setting-value">
{{wizard-mapper
inputs=action.messageable_level
inputs=this.action.messageable_level
property="messageable_level"
onUpdate=(action "mappedFieldUpdated")
options=(hash
@ -707,7 +707,7 @@
<div class="setting-value">
{{wizard-mapper
inputs=action.visibility_level
inputs=this.action.visibility_level
property="visibility_level"
onUpdate=(action "mappedFieldUpdated")
options=(hash
@ -728,7 +728,7 @@
<div class="setting-value">
{{wizard-mapper
inputs=action.members_visibility_level
inputs=this.action.members_visibility_level
property="members_visibility_level"
onUpdate=(action "mappedFieldUpdated")
options=(hash
@ -750,7 +750,7 @@
<div class="setting-value">
{{wizard-mapper
inputs=action.name
inputs=this.action.name
property="name"
onUpdate=(action "mappedFieldUpdated")
options=(hash
@ -770,7 +770,7 @@
<div class="setting-value">
{{wizard-mapper
inputs=action.slug
inputs=this.action.slug
property="slug"
onUpdate=(action "mappedFieldUpdated")
options=(hash
@ -790,7 +790,7 @@
<div class="setting-value">
{{wizard-mapper
inputs=action.color
inputs=this.action.color
property="color"
onUpdate=(action "mappedFieldUpdated")
options=(hash
@ -810,7 +810,7 @@
<div class="setting-value">
{{wizard-mapper
inputs=action.text_color
inputs=this.action.text_color
property="text_color"
onUpdate=(action "mappedFieldUpdated")
options=(hash
@ -832,7 +832,7 @@
<div class="setting-value">
{{wizard-mapper
inputs=action.parent_category_id
inputs=this.action.parent_category_id
property="parent_category_id"
onUpdate=(action "mappedFieldUpdated")
options=(hash
@ -853,7 +853,7 @@
<div class="setting-value">
{{wizard-mapper
inputs=action.permissions
inputs=this.action.permissions
property="permissions"
onUpdate=(action "mappedFieldUpdated")
options=(hash
@ -878,7 +878,7 @@
<div class="setting-value">
{{wizard-mapper
inputs=action.custom_fields
inputs=this.action.custom_fields
property="custom_fields"
onUpdate=(action "mappedFieldUpdated")
options=(hash
@ -903,7 +903,7 @@
<div class="setting-value">
{{wizard-mapper
inputs=action.required
inputs=this.action.required
property="required"
onUpdate=(action "mappedFieldUpdated")
options=(hash

Datei anzeigen

@ -1,23 +1,23 @@
{{wizard-mapper-connector
connector=input.type
connectors=inputTypes
connector=this.input.type
connectors=this.inputTypes
inputTypes=true
inputType=inputType
inputType=this.inputType
connectorType="type"
options=options
onUpdate=onUpdate
options=this.options
onUpdate=this.onUpdate
}}
{{#if hasPairs}}
<div class="mapper-pairs mapper-block">
{{#each input.pairs as |pair|}}
{{#each this.input.pairs as |pair|}}
{{wizard-mapper-pair
pair=pair
last=pair.last
inputType=inputType
options=options
inputType=this.inputType
options=this.options
removePair=(action "removePair")
onUpdate=onUpdate
onUpdate=this.onUpdate
}}
{{/each}}
@ -32,27 +32,27 @@
{{#if hasOutput}}
{{#if hasPairs}}
{{wizard-mapper-connector
connector=input.output_connector
connectors=connectors
connector=this.input.output_connector
connectors=this.connectors
connectorType="output"
inputType=inputType
options=options
onUpdate=onUpdate
inputType=this.inputType
options=this.options
onUpdate=this.onUpdate
}}
{{/if}}
<div class="output mapper-block">
{{wizard-mapper-selector
selectorType="output"
inputType=input.type
value=input.output
activeType=input.output_type
options=options
onUpdate=onUpdate
inputType=this.input.type
value=this.input.output
activeType=this.input.output_type
options=this.options
onUpdate=this.onUpdate
}}
</div>
{{/if}}
<a role="button" class="remove-input" {{action remove input}}>
<a role="button" class="remove-input" {{action remove this.input}}>
{{d-icon "times"}}
</a>

Datei anzeigen

@ -1,35 +0,0 @@
{{#d-modal-body title="admin.wizard.edit_columns"}}
{{#if loading}}
{{loading-spinner size="large"}}
{{else}}
<div class="edit-directory-columns-container">
{{#each model.columns as |column|}}
<div class="edit-directory-column">
<div class="left-content">
<label class="column-name">
{{input type="checkbox" checked=column.enabled}}
{{directory-table-header-title
field=column.label
translated=true
}}
</label>
</div>
</div>
{{/each}}
</div>
{{/if}}
{{/d-modal-body}}
<div class="modal-footer">
{{d-button
class="btn-primary"
label="directory.edit_columns.save"
action=(action "save")
}}
{{d-button
class="btn-secondary reset-to-default"
label="directory.edit_columns.reset_to_default"
action=(action "resetToDefault")
}}
</div>

Datei anzeigen

@ -1,17 +0,0 @@
{{#d-modal-body class="next-session-time-modal" title=title}}
{{date-time-input
date=bufferedDateTime
onChange=(action "dateTimeChanged")
showTime=true
clearable=true
}}
{{/d-modal-body}}
<div class="modal-footer">
{{d-button
action=(action "submit")
class="btn-primary"
label="admin.wizard.after_time_modal.done"
disabled=submitDisabled
}}
</div>

Datei anzeigen

@ -55,6 +55,8 @@ en:
liquid_syntax_error: "Liquid syntax error in %{attribute}: %{message}"
subscription: "%{type} %{property} usage is not supported on your subscription"
not_permitted_for_guests: "%{object_id} is not permitted when guests can access the wizard"
error_messages:
wizard_replacing_composer: "Category not allowed for topic creation."
site_settings:
custom_wizard_enabled: "Enable custom wizards."

Datei anzeigen

@ -10,19 +10,19 @@ class CustomWizard::Subscription
{
wizard: {
required: {
none: [],
none: ['*'],
standard: ['*'],
business: ['*'],
community: ['*']
},
permitted: {
none: [],
none: ['*'],
standard: ['*'],
business: ['*'],
community: ['*', "!#{CustomWizard::Wizard::GUEST_GROUP_ID}"]
},
restart_on_revisit: {
none: [],
none: ['*'],
standard: ['*'],
business: ['*'],
community: ['*']
@ -30,19 +30,19 @@ class CustomWizard::Subscription
},
step: {
condition: {
none: [],
none: ['*'],
standard: ['*'],
business: ['*'],
community: ['*']
},
required_data: {
none: [],
none: ['*'],
standard: ['*'],
business: ['*'],
community: ['*']
},
permitted_params: {
none: [],
none: ['*'],
standard: ['*'],
business: ['*'],
community: ['*']
@ -50,19 +50,19 @@ class CustomWizard::Subscription
},
field: {
condition: {
none: [],
none: ['*'],
standard: ['*'],
business: ['*'],
community: ['*']
},
type: {
none: ['text', 'textarea', 'text_only', 'date', 'time', 'date_time', 'number', 'checkbox', 'dropdown', 'upload'],
none: ['*'],
standard: ['*'],
business: ['*'],
community: ['*']
},
realtime_validations: {
none: [],
none: ['*'],
standard: ['*'],
business: ['*'],
community: ['*']
@ -70,7 +70,7 @@ class CustomWizard::Subscription
},
action: {
type: {
none: ['create_topic', 'update_profile', 'open_composer', 'route_to'],
none: ['*'],
standard: ['create_topic', 'update_profile', 'open_composer', 'route_to', 'send_message', 'watch_categories', 'watch_tags', 'add_to_group'],
business: ['*'],
community: ['*']
@ -78,13 +78,13 @@ class CustomWizard::Subscription
},
custom_field: {
klass: {
none: ['topic', 'post'],
none: ['*'],
standard: ['topic', 'post'],
business: ['*'],
community: ['*']
},
type: {
none: ['string', 'boolean', 'integer'],
none: ['*'],
standard: ['string', 'boolean', 'integer'],
business: ['*'],
community: ['*']
@ -92,7 +92,7 @@ class CustomWizard::Subscription
},
api: {
all: {
none: [],
none: ['*'],
standard: [],
business: ['*'],
community: ['*']
@ -154,14 +154,11 @@ class CustomWizard::Subscription
end
def type
return :none unless subscribed?
return :business if business?
return :standard if standard?
return :community if community?
return :business
end
def subscribed?
standard? || business? || community?
true
end
def standard?
@ -169,7 +166,7 @@ class CustomWizard::Subscription
end
def business?
product_slug === "business"
true
end
def community?

Datei anzeigen

@ -1,7 +1,7 @@
# frozen_string_literal: true
# name: discourse-custom-wizard
# about: Forms for Discourse. Better onboarding, structured posting, data enrichment, automated actions and much more.
# version: 2.4.19
# version: 2.4.23
# authors: Angus McLeod, Faizaan Gagan, Robert Barrow, Keegan George, Kaitlin Maddever, Juan Marcos Gutierrez Ramos
# url: https://github.com/paviliondev/discourse-custom-wizard
# contact_emails: development@pavilion.tech
@ -236,4 +236,13 @@ after_initialize do
end
DiscourseEvent.trigger(:custom_wizard_ready)
on(:before_create_topic) do |topic_params, user|
category = topic_params.category
if category&.custom_fields&.[]('create_topic_wizard').present?
raise Discourse::InvalidParameters.new(
I18n.t('wizard.error_messages.wizard_replacing_composer')
)
end
end
end

Datei anzeigen

@ -24,7 +24,7 @@ describe CustomWizard::Subscription do
context "without a subscription client" do
it "is not subscribed" do
expect(described_class.subscribed?).to eq(false)
expect(described_class.subscribed?).to eq(true)
end
it "has none type" do

Datei anzeigen

@ -0,0 +1,45 @@
# frozen_string_literal: true
describe Topic, type: :model do
fab!(:category_with_wizard) do
Fabricate(:category, custom_fields: { create_topic_wizard: 'true' })
end
fab!(:category_without_wizard) { Fabricate(:category) }
fab!(:user) { Fabricate(:user) }
let(:valid_attrs) { Fabricate.attributes_for(:topic) }
context 'with a create_topic_wizard custom field in the category' do
it 'will not allow creating a topic directly' do
expect do
TopicCreator.create(
user,
Guardian.new(user),
valid_attrs.merge(
title: 'A valid and sufficiently long title for testing',
category: category_with_wizard.id,
raw: 'hello this is a test topic with category with custom fields'
)
)
end.to raise_error(
Discourse::InvalidParameters,
'Category not allowed for topic creation.'
)
end
end
context 'without a create_topic_wizard custom field in the category' do
it 'will allow creating a topic directly' do
expect do
TopicCreator.create(
user,
Guardian.new(user),
valid_attrs.merge(
category: category_without_wizard.id,
title: 'Another valid and sufficiently long title for testing',
raw: 'This is the body of a valid topic'
)
)
end.not_to raise_error
end
end
end

Datei anzeigen

@ -24,7 +24,7 @@ describe CustomWizard::SubmissionSerializer do
it 'should return submission attributes' do
wizard = CustomWizard::Wizard.create(template_json["id"])
list = CustomWizard::Submission.list(wizard, page: 0)
list = CustomWizard::Submission.list(wizard, page: 0, order_by: 'id')
json_array = ActiveModel::ArraySerializer.new(
list.submissions,

Datei anzeigen

@ -13,7 +13,7 @@ import {
} from "../helpers/admin-wizard";
import { Promise } from "rsvp";
acceptance("Admin | Custom Fields Unsuscribed", function (needs) {
acceptance("Admin | Custom Fields Unsubscribed", function (needs) {
needs.user();
needs.settings({
custom_wizard_enabled: true,

Datei anzeigen

@ -16,7 +16,7 @@ import {
getWizard,
} from "../helpers/admin-wizard";
acceptance("Admin | Custom Wizard Unsuscribed", function (needs) {
acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
needs.user();
needs.settings({
custom_wizard_enabled: true,

Datei anzeigen

@ -0,0 +1,82 @@
import { click, visit } from "@ember/test-helpers";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import selectKit from "discourse/tests/helpers/select-kit-helper";
import { test } from "qunit";
acceptance("Category Chooser Initializer", function (needs) {
needs.user();
needs.settings({
allow_uncategorized_topics: false,
});
needs.site({
can_tag_topics: true,
categories: [
{
id: 1,
name: "General",
slug: "general",
permission: 1,
topic_template: null,
},
{
id: 2,
name: "Category with custom field",
slug: "category-custom-field",
permission: 1,
topic_template: "",
custom_fields: {
create_topic_wizard: "21",
},
},
{
id: 3,
name: "Category 1",
slug: "category-1",
permission: 1,
topic_template: "",
},
{
id: 4,
name: "Category 2",
slug: "category-2",
permission: 1,
topic_template: "",
},
],
});
test("does not display category with create_topic_wizard custom field", async function (assert) {
const categoryChooser = selectKit(".category-chooser");
await visit("/");
await click("#create-topic");
await categoryChooser.expand();
let categories = Array.from(
document.querySelectorAll(".category-chooser .category-row")
).filter((category) => category.getAttribute("data-name")); // Filter elements with a data-name attribute
assert.equal(
categories.length,
3,
"Correct number of categories are displayed"
);
const categoryNames = ["General", "Category 1", "Category 2"];
categoryNames.forEach((categoryName) => {
assert.ok(
categories.some(
(category) => category.getAttribute("data-name") === categoryName
),
`Category '${categoryName}' is displayed`
);
});
const categoryNameWithCustomField = "Category with custom field";
assert.notOk(
categories.some(
(category) =>
category.getAttribute("data-name") === categoryNameWithCustomField
),
`Category '${categoryNameWithCustomField}' is not displayed`
);
});
});

Datei anzeigen

@ -74,6 +74,15 @@ acceptance("Wizard | Redirect", function (needs) {
"pending wizard routing works"
);
});
test("Don't redirect to pending Wizard when ingore redirect param is supplied", async function (assert) {
sinon.stub(DiscourseURL, "routeTo");
await visit("/latest?ignore_redirect=1");
assert.notOk(
DiscourseURL.routeTo.calledWith("/w/wizard"),
"pending wizard routing blocked"
);
});
});
acceptance("Wizard | Wizard", function (needs) {

Datei anzeigen

@ -121,19 +121,19 @@ const getUnsubscribedAdminWizards = {
subscription_attributes: {
wizard: {
required: {
none: [],
none: ['*'],
standard: ["*"],
business: ["*"],
community: ["*"],
},
permitted: {
none: [],
none: ['*'],
standard: ["*"],
business: ["*"],
community: ["*"],
},
restart_on_revisit: {
none: [],
none: ['*'],
standard: ["*"],
business: ["*"],
community: ["*"],
@ -141,19 +141,19 @@ const getUnsubscribedAdminWizards = {
},
step: {
condition: {
none: [],
none: ['*'],
standard: ["*"],
business: ["*"],
community: ["*"],
},
required_data: {
none: [],
none: ['*'],
standard: ["*"],
business: ["*"],
community: ["*"],
},
permitted_params: {
none: [],
none: ['*'],
standard: ["*"],
business: ["*"],
community: ["*"],
@ -161,30 +161,19 @@ const getUnsubscribedAdminWizards = {
},
field: {
condition: {
none: [],
none: ['*'],
standard: ["*"],
business: ["*"],
community: ["*"],
},
type: {
none: [
"text",
"textarea",
"text_only",
"date",
"time",
"date_time",
"number",
"checkbox",
"dropdown",
"upload",
],
none: ['*'],
standard: ["*"],
business: ["*"],
community: ["*"],
},
realtime_validations: {
none: [],
none: ['*'],
standard: ["*"],
business: ["*"],
community: ["*"],
@ -192,7 +181,7 @@ const getUnsubscribedAdminWizards = {
},
action: {
type: {
none: ["create_topic", "update_profile", "open_composer", "route_to"],
none: ['*'],
standard: [
"create_topic",
"update_profile",
@ -208,20 +197,20 @@ const getUnsubscribedAdminWizards = {
},
custom_field: {
klass: {
none: ["topic", "post"],
none: ['*'],
standard: ["topic", "post"],
business: ["*"],
community: ["*"],
},
type: {
none: ["string", "boolean", "integer"],
none: ['*'],
standard: ["string", "boolean", "integer"],
business: ["*"],
community: ["*"],
},
},
api: {
all: { none: [], standard: [], business: ["*"], community: ["*"] },
all: { none: ["*"], standard: [], business: ["*"], community: ["*"] },
},
},
subscription_client_installed: false,