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,17 +66,12 @@ 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;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (category) {
|
if (category) {
|
||||||
|
@ -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,41 +1,37 @@
|
||||||
{{#if errorHtml}}
|
<div class="container">
|
||||||
{{html-safe errorHtml}}
|
{{discourse-banner user=currentUser banner=site.banner}}
|
||||||
{{else}}
|
{{#unless viewingCategoriesList}}
|
||||||
|
{{category-read-only-banner category=category readOnly=navigationCategory.cannotCreateTopicOnCategory}}
|
||||||
|
{{/unless}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="list-controls">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
{{discourse-banner user=currentUser banner=site.banner}}
|
{{outlet "navigation-bar"}}
|
||||||
{{#unless viewingCategoriesList}}
|
|
||||||
{{category-read-only-banner category=category readOnly=navigationCategory.cannotCreateTopicOnCategory}}
|
|
||||||
{{/unless}}
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="list-controls">
|
{{conditional-loading-spinner condition=loading}}
|
||||||
<div class="container">
|
|
||||||
{{outlet "navigation-bar"}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{conditional-loading-spinner condition=loading}}
|
{{plugin-outlet name="discovery-above"}}
|
||||||
|
|
||||||
{{plugin-outlet name="discovery-above"}}
|
<div class="container list-container {{if loading "hidden"}}">
|
||||||
|
<div class="row">
|
||||||
<div class="container list-container {{if loading "hidden"}}">
|
<div class="full-width">
|
||||||
<div class="row">
|
<div id="header-list-area">
|
||||||
<div class="full-width">
|
{{outlet "header-list-container"}}
|
||||||
<div id="header-list-area">
|
|
||||||
{{outlet "header-list-container"}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="full-width">
|
|
||||||
<div id="list-area">
|
|
||||||
{{plugin-outlet name="discovery-list-container-top"
|
|
||||||
args=(hash category=category listLoading=loading)}}
|
|
||||||
{{outlet "list-container"}}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="full-width">
|
||||||
|
<div id="list-area">
|
||||||
|
{{plugin-outlet name="discovery-list-container-top"
|
||||||
|
args=(hash category=category listLoading=loading)}}
|
||||||
|
{{outlet "list-container"}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{{plugin-outlet name="discovery-below"}}
|
{{plugin-outlet name="discovery-below"}}
|
||||||
{{/if}}
|
|
||||||
|
|
Loading…
Reference in New Issue