Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/custom_wizard/steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def update
updater.errors.messages.each do |field, msg|
errors << { field: field, description: msg.join(",") }
end
render json: { errors: errors }, status: 422
render json: { errors: errors }, status: :unprocessable_entity
end
end

Expand Down
9 changes: 9 additions & 0 deletions app/controllers/custom_wizard/tags.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# frozen_string_literal: true

class CustomWizard::TagsController < ::ApplicationController
requires_plugin "discourse-custom-wizard"

def search
render_json_dump(results: CustomWizard::TagSearch.new(guardian, params).results)
end
end
Comment thread
angusmcleod marked this conversation as resolved.
Dismissed
2 changes: 1 addition & 1 deletion app/controllers/custom_wizard/wizard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class CustomWizard::WizardController < ::CustomWizard::WizardClientController
def show
if wizard.present?
render json: CustomWizard::WizardSerializer.new(wizard, scope: guardian, root: false).as_json,
status: 200
status: :ok
else
render json: { error: I18n.t("wizard.none") }
end
Expand Down
4 changes: 2 additions & 2 deletions app/serializers/custom_wizard/wizard_step_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ def index
end

def next
object.next.id if object.next.present?
(object.next.presence&.id)
end

def include_next?
object.next.present?
end

def previous
object.previous.id if object.previous.present?
(object.previous.presence&.id)
end

def include_previous?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default class CustomUserSelector extends Component {
username: trimmedUsername,
name: trimmedUsername,
id: trimmedUsername,
isUser: true
isUser: true,
};
});
}
Expand All @@ -89,7 +89,7 @@ export default class CustomUserSelector extends Component {
includeGroups: this.includeGroups,
allowedUsers: this.allowedUsers,
includeMentionableGroups: this.includeMentionableGroups,
includeMessageableGroups: this.includeMessageableGroups
includeMessageableGroups: this.includeMessageableGroups,
});

// Transform results to include both users and groups
Expand All @@ -100,7 +100,7 @@ export default class CustomUserSelector extends Component {
...results.users.map((user) => ({
...user,
isUser: true,
id: user.username // Use username as ID for comparison
id: user.username, // Use username as ID for comparison
}))
);
}
Expand All @@ -111,7 +111,7 @@ export default class CustomUserSelector extends Component {
...group,
isGroup: true,
name: group.name, // Groups use name as username
id: group.name // Use name as ID for comparison
id: group.name, // Use name as ID for comparison
}))
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import discourseComputed from "discourse-common/utils/decorators";

export default DateInput.extend({
useNativePicker: false,
classNameBindings: ["fieldClass"],

@discourseComputed()
placeholder() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import DateTimeInput from "discourse/components/date-time-input";
import discourseComputed from "discourse-common/utils/decorators";

export default DateTimeInput.extend({
classNameBindings: ["fieldClass"],

@discourseComputed("timeFirst", "tabindex")
timeTabindex(timeFirst, tabindex) {
return timeFirst ? tabindex : tabindex + 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
class=this.fieldClass
tabindex=this.field.tabindex
tagGroups=this.field.tag_groups
whitelist=this.field.content
everyTag=true
options=(hash maximum=this.field.limit allowAny=this.field.can_create_tag)
}}
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ export default TagChooser.extend({

search(query) {
const selectedTags = makeArray(this.tags).filter(Boolean);
const blockedTags = this._normalizedBlockedTags;

const data = {
q: query,
limit: this.siteSettings.max_tag_search_results,
categoryId: this.categoryId,
};

if (selectedTags.length || this.blockedTags.length) {
if (selectedTags.length || blockedTags.length) {
const { selectedTagIds, selectedTagNames } = this._selectedTagPayload(
selectedTags,
this.blockedTags
blockedTags
);

if (selectedTagIds.length) {
Expand All @@ -45,24 +45,19 @@ export default TagChooser.extend({
}
}

if (!this.everyTag) {
data.filterForInput = true;
if (this.tagGroups?.length) {
data.tag_groups = this.tagGroups.join(",");
}
if (this.excludeSynonyms) {
data.excludeSynonyms = true;
}
if (this.excludeHasSynonyms) {
data.excludeHasSynonyms = true;
}
if (this.tagGroups) {
let tagGroupsString = this.tagGroups.join(",");
data.filterForInput = {
name: "custom-wizard-tag-chooser",
groups: tagGroupsString,
};

const contentTags = makeArray(this.whitelist)
.map((tag) => (typeof tag === "string" ? tag : tag?.name))
.filter(Boolean);
if (contentTags.length) {
data.content = contentTags;
}

return this.tagUtils.searchTags(
"/tags/filter/search",
"/custom-wizard/tags/search",
data,
this._transformJson
);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
{{#each this.validationRows as |row|}}
<li>
<span class="setting-title">
<h4>{{i18n
(concat "admin.wizard.field.validations." row.type)
}}</h4>
<h4>{{i18n (concat "admin.wizard.field.validations." row.type)}}</h4>
<Input @type="checkbox" @checked={{row.props.status}} />
{{i18n "admin.wizard.field.validations.enabled"}}
</span>
Expand Down Expand Up @@ -92,15 +90,15 @@
class="answer-expected"
/>
<div class="instructions">
{{i18n "admin.wizard.field.validations.expected_instructions"}}
{{i18n
"admin.wizard.field.validations.expected_instructions"
}}
</div>
</div>
</div>
<div class="validation-section">
<div class="setting-label">
<label>{{i18n
"admin.wizard.field.validations.match"
}}</label>
<label>{{i18n "admin.wizard.field.validations.match"}}</label>
</div>
<div class="setting-value">
{{radio-button
Expand All @@ -123,9 +121,7 @@
</div>
<div class="validation-section">
<div class="setting-label">
<label>{{i18n
"admin.wizard.field.validations.message"
}}</label>
<label>{{i18n "admin.wizard.field.validations.message"}}</label>
</div>
<div class="setting-value">
<Input
Expand All @@ -143,4 +139,4 @@
</li>
{{/each}}
</ul>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ export default Component.extend({

const validationBuffer = cloneJSON(this.get("field.validations"));
if (validationBuffer.similar_topics) {
const bufferCategories =
validationBuffer.similar_topics.categories || [];
const bufferCategories = validationBuffer.similar_topics.categories || [];
validationBuffer.similar_topics.categories =
Category.findByIds(bufferCategories);
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion assets/javascripts/discourse/lib/wizard-schema.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { get, set } from "@ember/object";
import { getOwnerWithFallback } from "discourse-common/lib/get-owner";

const wizard = {
basic: {
Expand Down
Loading
Loading