mirror of
https://github.com/discourse/discourse.git
synced 2025-02-07 01:53:21 +08:00
FIX: Display embeddable host's post to category. (#14517)
The host's category was successfully updated on the database, but the category property was not properly set when rendering the component for the first time.
This commit is contained in:
parent
dbbfad7ed0
commit
766d337d42
|
@ -12,9 +12,20 @@ export default Component.extend(bufferedProperty("host"), {
|
||||||
editToggled: false,
|
editToggled: false,
|
||||||
tagName: "tr",
|
tagName: "tr",
|
||||||
categoryId: null,
|
categoryId: null,
|
||||||
|
category: null,
|
||||||
|
|
||||||
editing: or("host.isNew", "editToggled"),
|
editing: or("host.isNew", "editToggled"),
|
||||||
|
|
||||||
|
init() {
|
||||||
|
this._super(...arguments);
|
||||||
|
|
||||||
|
const host = this.host;
|
||||||
|
const categoryId = host.category_id || this.site.uncategorized_category_id;
|
||||||
|
const category = Category.findById(categoryId);
|
||||||
|
|
||||||
|
host.set("category", category);
|
||||||
|
},
|
||||||
|
|
||||||
@discourseComputed("buffered.host", "host.isSaving")
|
@discourseComputed("buffered.host", "host.isSaving")
|
||||||
cantSave(host, isSaving) {
|
cantSave(host, isSaving) {
|
||||||
return isSaving || isEmpty(host);
|
return isSaving || isEmpty(host);
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
<td><div class="label">{{i18n "admin.embedding.host"}}</div>{{host.host}}</td>
|
<td><div class="label">{{i18n "admin.embedding.host"}}</div>{{host.host}}</td>
|
||||||
<td><div class="label">{{i18n "admin.embedding.class_name"}}</div>{{host.class_name}}</td>
|
<td><div class="label">{{i18n "admin.embedding.class_name"}}</div>{{host.class_name}}</td>
|
||||||
<td><div class="label">{{i18n "admin.embedding.allowed_paths"}}</div>{{host.allowed_paths}}</td>
|
<td><div class="label">{{i18n "admin.embedding.allowed_paths"}}</div>{{host.allowed_paths}}</td>
|
||||||
<td><div class="label">{{i18n "admin.embedding.category"}}</div>{{category-badge host.category}}</td>
|
<td><div class="label">{{i18n "admin.embedding.category"}}</div>{{category-badge host.category allowUncategorized=true}}</td>
|
||||||
<td class="controls">
|
<td class="controls">
|
||||||
{{d-button icon="pencil-alt" action=(action "edit")}}
|
{{d-button icon="pencil-alt" action=(action "edit")}}
|
||||||
{{d-button icon="far-trash-alt" action=(action "delete") class="btn-danger"}}
|
{{d-button icon="far-trash-alt" action=(action "delete") class="btn-danger"}}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user