mirror of
https://github.com/discourse/discourse.git
synced 2025-06-03 19:39:30 +08:00
FIX: category-drop initial state was incorrect (#6743)
This commit is contained in:
@ -17,7 +17,6 @@ export default ComboBoxComponent.extend({
|
||||
tagName: "li",
|
||||
categoryStyle: Ember.computed.alias("siteSettings.category_style"),
|
||||
noCategoriesLabel: I18n.t("categories.no_subcategory"),
|
||||
mutateAttributes() {},
|
||||
fullWidthOnMobile: true,
|
||||
caretDownIcon: "caret-right",
|
||||
caretUpIcon: "caret-down",
|
||||
@ -53,14 +52,7 @@ export default ComboBoxComponent.extend({
|
||||
},
|
||||
|
||||
init() {
|
||||
this._super();
|
||||
|
||||
if (this.get("category")) {
|
||||
this.set("value", this.get("category.id"));
|
||||
} else {
|
||||
this.set("value", null);
|
||||
}
|
||||
if (!this.get("categories")) this.set("categories", []);
|
||||
this._super(...arguments);
|
||||
|
||||
this.get("rowComponentOptions").setProperties({
|
||||
hideParentCategory: this.get("subCategory"),
|
||||
@ -73,6 +65,11 @@ export default ComboBoxComponent.extend({
|
||||
});
|
||||
},
|
||||
|
||||
didReceiveAttrs() {
|
||||
if (!this.get("categories")) this.set("categories", []);
|
||||
this.forceValue(this.get("category.id"));
|
||||
},
|
||||
|
||||
@computed("content")
|
||||
filterable(content) {
|
||||
const contentLength = (content && content.length) || 0;
|
||||
|
@ -115,6 +115,11 @@ export default SelectKitComponent.extend({
|
||||
},
|
||||
mutateContent() {},
|
||||
|
||||
forceValues(values) {
|
||||
this.mutateValues(values);
|
||||
this._compute();
|
||||
},
|
||||
|
||||
filterComputedContent(computedContent, computedValues, filter) {
|
||||
return computedContent.filter(c => {
|
||||
return this._normalize(get(c, "name")).indexOf(filter) > -1;
|
||||
|
@ -56,6 +56,11 @@ export default SelectKitComponent.extend({
|
||||
this.set("value", computedValue);
|
||||
},
|
||||
|
||||
forceValue(value) {
|
||||
this.mutateValue(value);
|
||||
this._compute();
|
||||
},
|
||||
|
||||
_beforeWillComputeValue(value) {
|
||||
if (
|
||||
!isEmpty(this.get("content")) &&
|
||||
|
Reference in New Issue
Block a user