Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-25 02:30:28 +01:00
FIX: various fixes for realtime validations feature
See further https://coop.pavilion.tech/t/similar-posts-category-picker-not-working/3513
Dieser Commit ist enthalten in:
Ursprung
f066ff938e
Commit
0d0fb83bd1
6 geänderte Dateien mit 17 neuen und 18 gelöschten Zeilen
|
@ -1,6 +1,6 @@
|
|||
import Component from "@ember/component";
|
||||
import { equal } from "@ember/object/computed";
|
||||
import { ajax, getToken } from "discourse/lib/ajax";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
|
||||
export default Component.extend({
|
||||
classNames: ["validator"],
|
||||
|
@ -20,7 +20,6 @@ export default Component.extend({
|
|||
return ajax("/realtime-validations", {
|
||||
data: {
|
||||
type: this.get("type"),
|
||||
authenticity_token: getToken(),
|
||||
...params,
|
||||
},
|
||||
});
|
||||
|
|
|
@ -35,13 +35,12 @@ export default Component.extend({
|
|||
}
|
||||
|
||||
const validationBuffer = cloneJSON(this.get("field.validations"));
|
||||
let bufferCategories;
|
||||
if (
|
||||
validationBuffer.similar_topics &&
|
||||
(bufferCategories = validationBuffer.similar_topics.categories)
|
||||
) {
|
||||
const categories = Category.findByIds(bufferCategories);
|
||||
validationBuffer.similar_topics.categories = categories;
|
||||
let bufferCategories = validationBuffer.similar_topics?.categories || [];
|
||||
if (bufferCategories) {
|
||||
validationBuffer.similar_topics.categories =
|
||||
Category.findByIds(bufferCategories);
|
||||
} else {
|
||||
validationBuffer.similar_topics.categories = [];
|
||||
}
|
||||
this.set("validationBuffer", validationBuffer);
|
||||
},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<a href={{topic.url}} target="_blank" rel="noopener noreferrer">
|
||||
<span class="title">{{html-safe topic.fancy_title}}</span>
|
||||
<div class="blurb">{{date-node topic.created_at}}
|
||||
<div class="blurb"><RelativeDate @date={{@topic.created_at}} />
|
||||
-
|
||||
{{html-safe topic.blurb}}</div>
|
||||
</a>
|
|
@ -18,13 +18,14 @@
|
|||
}}</label>
|
||||
</div>
|
||||
<div class="setting-value">
|
||||
{{category-selector
|
||||
categories=(get
|
||||
this (concat "validationBuffer." type ".categories")
|
||||
)
|
||||
onChange=(action "updateValidationCategories" type props)
|
||||
<CategorySelector
|
||||
@categories={{get
|
||||
this
|
||||
(concat "validationBuffer." type ".categories")
|
||||
}}
|
||||
@onChange={{action "updateValidationCategories" type props}}
|
||||
class="wizard"
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="validation-section">
|
||||
|
|
|
@ -27,7 +27,7 @@ class CustomWizard::RealtimeValidation::SimilarTopics
|
|||
|
||||
result = CustomWizard::RealtimeValidation::Result.new(:similar_topic)
|
||||
|
||||
if title.length < SiteSetting.min_title_similar_length || !Topic.count_exceeds_minimum?
|
||||
if title.length < SiteSetting.min_title_similar_length
|
||||
return result
|
||||
end
|
||||
|
||||
|
|
|
@ -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.6.7
|
||||
# version: 2.6.8
|
||||
# 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
|
||||
|
|
Laden …
In neuem Issue referenzieren