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:
Kane York 2020-12-08 11:58:36 -08:00 committed by GitHub
parent a446e0fde1
commit 59ef48c0b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 55 deletions

View File

@ -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);
}, },

View File

@ -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}}