diff --git a/.discourse-compatibility b/.discourse-compatibility
index 01ce2cde..ff1e994a 100644
--- a/.discourse-compatibility
+++ b/.discourse-compatibility
@@ -1,3 +1,4 @@
+3.2.0.beta2: 1ee2f7d8babafe32912372fbbfa50c89f5b09ba9
3.1.999: 1f35b80f85e5fd1efb7f4851f0845700432febdc
2.7.99: e07a57e398b6b1676ab42a7e34467556fca5416b
2.5.1: bb85b3a0d2c0ab6b59bcb405731c39089ec6731c
diff --git a/README.md b/README.md
index 0c454685..41aaeafc 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@ The Custom Wizard Plugin lets you make forms for your Discourse forum. Better us
-👋 Looking to report an issue? We're managing issues for this plugin using our [bug report wizard](https://coop.pavilion.tech/w/bug-report).
+👋 Looking to report an issue? We're managing issues for this plugin using our [bug report wizard](https://pavilion.tech/products/discourse-custom-wizard-plugin/support/bug-report).
## Install
@@ -12,16 +12,16 @@ If you're not sure how to install a plugin in Discourse, please follow the [plug
## Documentation
-[Read the full documentation here](https://coop.pavilion.tech/c/82), or go directly to the relevant section
+[Read the full documentation here](https://pavilion.tech/products/discourse-custom-wizard-plugin/documentation/), or go directly to the relevant section
- [Wizard Administration](https://coop.pavilion.tech/t/1602)
- [Wizard Settings](https://coop.pavilion.tech/t/1614)
-- [Step Settings](https://coop.pavilion.tech/t/1735)
-- [Field Settings](https://coop.pavilion.tech/t/1580)
-- [Conditional Settings](https://coop.pavilion.tech/t/1673)
-- [Field Interpolation](https://coop.pavilion.tech/t/1557)
+- [Step Settings](https://pavilion.tech/products/discourse-custom-wizard-plugin/documentation/step-settings)
+- [Field Settings](https://pavilion.tech/products/discourse-custom-wizard-plugin/documentation/field-settings)
+- [Conditional Settings](https://pavilion.tech/products/discourse-custom-wizard-plugin/documentation/conditional-settings)
+- [Field Interpolation](https://pavilion.tech/products/discourse-custom-wizard-plugin/documentation/field-interpolation)
- [Handling Dates and Times](https://coop.pavilion.tech/t/1708)
## Support
-- [Report an issue](https://coop.pavilion.tech/w/bug-report)
+- [Report an issue](https://pavilion.tech/products/discourse-custom-wizard-plugin/support/bug-report)
diff --git a/assets/javascripts/discourse/components/custom-wizard-field.js.es6 b/assets/javascripts/discourse/components/custom-wizard-field.js.es6
index d706ecd8..bb368310 100644
--- a/assets/javascripts/discourse/components/custom-wizard-field.js.es6
+++ b/assets/javascripts/discourse/components/custom-wizard-field.js.es6
@@ -1,7 +1,7 @@
import Component from "@ember/component";
import { dasherize } from "@ember/string";
import discourseComputed from "discourse-common/utils/decorators";
-import { cookAsync } from "discourse/lib/text";
+import { cook } from "discourse/lib/text";
export default Component.extend({
classNameBindings: [
@@ -14,7 +14,7 @@ export default Component.extend({
didReceiveAttrs() {
this._super(...arguments);
- cookAsync(this.field.translatedDescription).then((cookedDescription) => {
+ cook(this.field.translatedDescription).then((cookedDescription) => {
this.set("cookedDescription", cookedDescription);
});
},
diff --git a/assets/javascripts/discourse/components/custom-wizard-step.js.es6 b/assets/javascripts/discourse/components/custom-wizard-step.js.es6
index 7c933771..250f9140 100644
--- a/assets/javascripts/discourse/components/custom-wizard-step.js.es6
+++ b/assets/javascripts/discourse/components/custom-wizard-step.js.es6
@@ -4,7 +4,7 @@ import I18n from "I18n";
import getUrl from "discourse-common/lib/get-url";
import { htmlSafe } from "@ember/template";
import { schedule } from "@ember/runloop";
-import { cookAsync } from "discourse/lib/text";
+import { cook } from "discourse/lib/text";
import CustomWizard, {
updateCachedWizard,
} from "discourse/plugins/discourse-custom-wizard/discourse/models/custom-wizard";
@@ -25,10 +25,10 @@ export default Component.extend({
didReceiveAttrs() {
this._super(...arguments);
- cookAsync(this.step.translatedTitle).then((cookedTitle) => {
+ cook(this.step.translatedTitle).then((cookedTitle) => {
this.set("cookedTitle", cookedTitle);
});
- cookAsync(this.step.translatedDescription).then((cookedDescription) => {
+ cook(this.step.translatedDescription).then((cookedDescription) => {
this.set("cookedDescription", cookedDescription);
});
},
diff --git a/assets/javascripts/discourse/components/wizard-custom-action.js.es6 b/assets/javascripts/discourse/components/wizard-custom-action.js.es6
index 81a12530..b9329617 100644
--- a/assets/javascripts/discourse/components/wizard-custom-action.js.es6
+++ b/assets/javascripts/discourse/components/wizard-custom-action.js.es6
@@ -41,7 +41,8 @@ export default Component.extend(UndoChanges, {
};
}),
- messageUrl: "https://discourse.pluginmanager.org/t/action-settings",
+ messageUrl:
+ "https://pavilion.tech/products/discourse-custom-wizard-plugin/documentation/action-settings",
@discourseComputed("action.type")
messageKey(type) {
diff --git a/assets/javascripts/discourse/components/wizard-custom-field.js.es6 b/assets/javascripts/discourse/components/wizard-custom-field.js.es6
index ed66012a..b19667ad 100644
--- a/assets/javascripts/discourse/components/wizard-custom-field.js.es6
+++ b/assets/javascripts/discourse/components/wizard-custom-field.js.es6
@@ -27,7 +27,8 @@ export default Component.extend(UndoChanges, {
isTextType: or("isText", "isTextarea", "isComposer"),
isComposerPreview: equal("field.type", "composer_preview"),
categoryPropertyTypes: selectKitContent(["id", "slug"]),
- messageUrl: "https://discourse.pluginmanager.org/t/field-settings",
+ messageUrl:
+ "https://pavilion.tech/products/discourse-custom-wizard-plugin/documentation/field-settings",
@discourseComputed("field.type")
validations(type) {
diff --git a/assets/javascripts/discourse/controllers/admin-wizards-custom-fields.js.es6 b/assets/javascripts/discourse/controllers/admin-wizards-custom-fields.js.es6
index 5d47d8d7..11e66782 100644
--- a/assets/javascripts/discourse/controllers/admin-wizards-custom-fields.js.es6
+++ b/assets/javascripts/discourse/controllers/admin-wizards-custom-fields.js.es6
@@ -4,7 +4,8 @@ import CustomWizardCustomField from "../models/custom-wizard-custom-field";
export default Controller.extend({
messageKey: "create",
fieldKeys: ["klass", "type", "name", "serializers"],
- documentationUrl: "https://discourse.pluginmanager.org/t/custom-fields",
+ documentationUrl:
+ "https://pavilion.tech/products/discourse-custom-wizard-plugin/documentation/custom-fields",
actions: {
addField() {
diff --git a/assets/javascripts/discourse/controllers/admin-wizards-logs.js.es6 b/assets/javascripts/discourse/controllers/admin-wizards-logs.js.es6
index 7388a8d6..0d321948 100644
--- a/assets/javascripts/discourse/controllers/admin-wizards-logs.js.es6
+++ b/assets/javascripts/discourse/controllers/admin-wizards-logs.js.es6
@@ -2,7 +2,8 @@ import Controller from "@ember/controller";
import { default as discourseComputed } from "discourse-common/utils/decorators";
export default Controller.extend({
- documentationUrl: "https://thepavilion.io/t/2818",
+ documentationUrl:
+ "https://pavilion.tech/products/discourse-custom-wizard-plugin/documentation/",
@discourseComputed("wizardId")
wizardName(wizardId) {
diff --git a/assets/javascripts/discourse/controllers/admin-wizards-manager.js.es6 b/assets/javascripts/discourse/controllers/admin-wizards-manager.js.es6
index 67016bd7..65b8987a 100644
--- a/assets/javascripts/discourse/controllers/admin-wizards-manager.js.es6
+++ b/assets/javascripts/discourse/controllers/admin-wizards-manager.js.es6
@@ -7,7 +7,8 @@ import I18n from "I18n";
import { underscore } from "@ember/string";
export default Controller.extend({
- messageUrl: "https://discourse.pluginmanager.org/t/wizard-manager",
+ messageUrl:
+ "https://pavilion.tech/products/discourse-custom-wizard-plugin/documentation/wizard-manager",
messageKey: "info",
messageIcon: "info-circle",
messageClass: "info",
diff --git a/assets/javascripts/discourse/controllers/admin-wizards-submissions.js.es6 b/assets/javascripts/discourse/controllers/admin-wizards-submissions.js.es6
index 7388a8d6..0d321948 100644
--- a/assets/javascripts/discourse/controllers/admin-wizards-submissions.js.es6
+++ b/assets/javascripts/discourse/controllers/admin-wizards-submissions.js.es6
@@ -2,7 +2,8 @@ import Controller from "@ember/controller";
import { default as discourseComputed } from "discourse-common/utils/decorators";
export default Controller.extend({
- documentationUrl: "https://thepavilion.io/t/2818",
+ documentationUrl:
+ "https://pavilion.tech/products/discourse-custom-wizard-plugin/documentation/",
@discourseComputed("wizardId")
wizardName(wizardId) {
diff --git a/assets/javascripts/discourse/controllers/admin-wizards-wizard.js.es6 b/assets/javascripts/discourse/controllers/admin-wizards-wizard.js.es6
index 5178a1e1..994dd1a6 100644
--- a/assets/javascripts/discourse/controllers/admin-wizards-wizard.js.es6
+++ b/assets/javascripts/discourse/controllers/admin-wizards-wizard.js.es6
@@ -22,5 +22,5 @@ export default Controller.extend({
},
messageUrl:
- "https://discourse.pluginmanager.org/c/discourse-custom-wizard/documentation",
+ "https://pavilion.tech/products/discourse-custom-wizard-plugin/documentation/",
});
diff --git a/assets/javascripts/discourse/initializers/custom-wizard-edits.js.es6 b/assets/javascripts/discourse/initializers/custom-wizard-edits.js.es6
index bd3c3d2d..ca72fa4b 100644
--- a/assets/javascripts/discourse/initializers/custom-wizard-edits.js.es6
+++ b/assets/javascripts/discourse/initializers/custom-wizard-edits.js.es6
@@ -87,10 +87,13 @@ 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;
- });
+ const currentUser = this.currentUser;
+ if (!currentUser?.staff) {
+ categories = categories.filter((category) => {
+ return !category.custom_fields?.create_topic_wizard;
+ });
+ }
+ return categories;
},
});
});
diff --git a/assets/javascripts/discourse/mixins/subscription.js.es6 b/assets/javascripts/discourse/mixins/subscription.js.es6
index 34276c3f..219a602b 100644
--- a/assets/javascripts/discourse/mixins/subscription.js.es6
+++ b/assets/javascripts/discourse/mixins/subscription.js.es6
@@ -7,7 +7,7 @@ const PRODUCT_PAGE = "https://custom-wizard.pavilion.tech";
const SUPPORT_MESSAGE =
"https://coop.pavilion.tech/new-message?username=support&title=Custom%20Wizard%20Support";
const MANAGER_CATEGORY =
- "https://discourse.pluginmanager.org/c/discourse-custom-wizard";
+ "https://pavilion.tech/products/discourse-custom-wizard-plugin/support";
export default Mixin.create({
subscriptionLandingUrl: PRODUCT_PAGE,
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 98519335..b4b9ba68 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -171,7 +171,7 @@ en:
not_subscribed: "You've authorized, but are not currently subscribed to a Custom Wizard plan on %{server}."
subscription_expiring: "Your subscription is active, but will expire in the next 48 hours."
subscription_active: "Your subscription is active."
- subscription_inactive: "Your subscription is inactive on this forum. Read more in the documentation."
+ subscription_inactive: "Your subscription is inactive on this forum. Read more in the documentation."
unauthorized: "You're unauthorized. If you have a subscription, it will become inactive in the next 48 hours."
unauthorize_failed: Failed to unauthorize.
submissions:
diff --git a/lib/custom_wizard/submission.rb b/lib/custom_wizard/submission.rb
index ae616b0b..7387902e 100644
--- a/lib/custom_wizard/submission.rb
+++ b/lib/custom_wizard/submission.rb
@@ -131,6 +131,8 @@ class CustomWizard::Submission
params[:key] = list_actor_id if list_actor_id
query = PluginStoreRow.where(params)
+ query = query.order(order_by) if order_by
+
result = OpenStruct.new(submissions: [], total: nil)
query.each do |record|
diff --git a/lib/custom_wizard/subscription.rb b/lib/custom_wizard/subscription.rb
index ee72b7f8..23de1808 100644
--- a/lib/custom_wizard/subscription.rb
+++ b/lib/custom_wizard/subscription.rb
@@ -157,7 +157,7 @@ class CustomWizard::Subscription
return :none unless subscribed?
return :business if business?
return :standard if standard?
- return :community if community?
+ :community if community?
end
def subscribed?
diff --git a/spec/serializers/custom_wizard/submission_serializer_spec.rb b/spec/serializers/custom_wizard/submission_serializer_spec.rb
index 10d254d5..fc2c46a2 100644
--- a/spec/serializers/custom_wizard/submission_serializer_spec.rb
+++ b/spec/serializers/custom_wizard/submission_serializer_spec.rb
@@ -40,7 +40,7 @@ describe CustomWizard::SubmissionSerializer do
it "should return field values, types and labels" 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,
diff --git a/test/javascripts/acceptance/category-chooser-initializer-test.js b/test/javascripts/acceptance/category-chooser-initializer-test.js
index f7e02bb8..0348e5bb 100644
--- a/test/javascripts/acceptance/category-chooser-initializer-test.js
+++ b/test/javascripts/acceptance/category-chooser-initializer-test.js
@@ -3,8 +3,8 @@ 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();
+acceptance("Category Chooser Initializer for regular users", function (needs) {
+ needs.user({ admin: false, moderator: false });
needs.settings({
allow_uncategorized_topics: false,
});
@@ -45,9 +45,8 @@ acceptance("Category Chooser Initializer", function (needs) {
],
});
- test("does not display category with create_topic_wizard custom field", async function (assert) {
+ test("does not display category with create_topic_wizard for regular users", async function (assert) {
const categoryChooser = selectKit(".category-chooser");
-
await visit("/");
await click("#create-topic");
await categoryChooser.expand();
@@ -80,3 +79,148 @@ acceptance("Category Chooser Initializer", function (needs) {
);
});
});
+
+acceptance("Category Chooser Initializer for Admins", function (needs) {
+ needs.user({ admin: true });
+ 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("displays all categories", 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,
+ 4,
+ "Correct number of categories are displayed"
+ );
+ const categoryNames = [
+ "General",
+ "Category 1",
+ "Category 2",
+ "Category with custom field",
+ ];
+
+ categoryNames.forEach((categoryName) => {
+ assert.ok(
+ categories.some(
+ (category) => category.getAttribute("data-name") === categoryName
+ ),
+ `Category '${categoryName}' is displayed`
+ );
+ });
+ });
+});
+acceptance("Category Chooser Initializer for Staff", function (needs) {
+ needs.user({ staff: true });
+ 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("displays all categories", 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,
+ 4,
+ "Correct number of categories are displayed"
+ );
+ const categoryNames = [
+ "General",
+ "Category 1",
+ "Category 2",
+ "Category with custom field",
+ ];
+
+ categoryNames.forEach((categoryName) => {
+ assert.ok(
+ categories.some(
+ (category) => category.getAttribute("data-name") === categoryName
+ ),
+ `Category '${categoryName}' is displayed`
+ );
+ });
+ });
+});