FIX: Remove custom 'error' action on build-category-route/discovery (#11425)
The root cause of the issue was that the route was overriding the 'error' action from the correctly implemented handler in routes/application.js.
Remove the custom handler, and the duplicated template logic for displaying the errorHtml.
Fixes: e16b3da04a
This commit is contained in:
parent
a446e0fde1
commit
59ef48c0b9
|
@ -66,16 +66,11 @@ export default (filterArg, params) => {
|
||||||
parts.pop();
|
parts.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Category.reloadBySlugPath(parts.join("/"))
|
return Category.reloadBySlugPath(parts.join("/")).then((result) => {
|
||||||
.then((result) => {
|
|
||||||
const record = this.store.createRecord("category", result.category);
|
const record = this.store.createRecord("category", result.category);
|
||||||
record.setupGroupsAndPermissions();
|
record.setupGroupsAndPermissions();
|
||||||
this.site.updateCategory(record);
|
this.site.updateCategory(record);
|
||||||
return { category: record, modelParams };
|
return { category: record, modelParams };
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
// afterModel will call replaceWith(/404)
|
|
||||||
return null;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,18 +239,6 @@ export default (filterArg, params) => {
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
error(err) {
|
|
||||||
const json = err.jqXHR.responseJSON;
|
|
||||||
if (json && json.extras && json.extras.html) {
|
|
||||||
this.controllerFor("discovery").set(
|
|
||||||
"errorHtml",
|
|
||||||
err.jqXHR.responseJSON.extras.html
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
this.replaceWith("exception");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
setNotification(notification_level) {
|
setNotification(notification_level) {
|
||||||
this.currentModel.setNotification(notification_level);
|
this.currentModel.setNotification(notification_level);
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
{{#if errorHtml}}
|
|
||||||
{{html-safe errorHtml}}
|
|
||||||
{{else}}
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
{{discourse-banner user=currentUser banner=site.banner}}
|
{{discourse-banner user=currentUser banner=site.banner}}
|
||||||
{{#unless viewingCategoriesList}}
|
{{#unless viewingCategoriesList}}
|
||||||
|
@ -38,4 +35,3 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{plugin-outlet name="discovery-below"}}
|
{{plugin-outlet name="discovery-below"}}
|
||||||
{{/if}}
|
|
||||||
|
|
Loading…
Reference in New Issue