mirror of
https://github.com/discourse/discourse.git
synced 2025-02-22 19:34:25 +08:00
FIX: Reset category edit page button state (#11218)
Fixes two small issues: - buttons stayed disabled after deleting a category - on a newly-created category, the Edit button was missing on the category landing page
This commit is contained in:
parent
df003eaf7b
commit
698b7ace10
@ -95,6 +95,7 @@ export default Controller.extend({
|
|||||||
model.setProperties({
|
model.setProperties({
|
||||||
slug: result.category.slug,
|
slug: result.category.slug,
|
||||||
id: result.category.id,
|
id: result.category.id,
|
||||||
|
can_edit: result.category.can_edit,
|
||||||
permission: PermissionType.FULL,
|
permission: PermissionType.FULL,
|
||||||
notification_level: NotificationLevels.REGULAR,
|
notification_level: NotificationLevels.REGULAR,
|
||||||
});
|
});
|
||||||
@ -115,15 +116,19 @@ export default Controller.extend({
|
|||||||
I18n.t("yes_value"),
|
I18n.t("yes_value"),
|
||||||
(result) => {
|
(result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.model.destroy().then(
|
this.model
|
||||||
|
.destroy()
|
||||||
|
.then(
|
||||||
() => {
|
() => {
|
||||||
this.transitionToRoute("discovery.categories");
|
this.transitionToRoute("discovery.categories");
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
this.displayErrors([I18n.t("category.delete_error")]);
|
this.displayErrors([I18n.t("category.delete_error")]);
|
||||||
this.set("deleting", false);
|
|
||||||
}
|
}
|
||||||
);
|
)
|
||||||
|
.finally(() => {
|
||||||
|
this.set("deleting", false);
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
this.set("deleting", false);
|
this.set("deleting", false);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user