mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 08:09:33 +08:00
FIX: Show detailed error messages for category pages. (#8832)
This commit is contained in:
parent
3bf870cb24
commit
2240b1681b
|
@ -419,6 +419,10 @@ Category.reopenClass({
|
|||
: ajax(`/c/${slug}/find_by_slug.json`);
|
||||
},
|
||||
|
||||
reloadBySlugPath(slugPath) {
|
||||
return ajax(`/c/${slugPath}/find_by_slug.json`);
|
||||
},
|
||||
|
||||
search(term, opts) {
|
||||
var limit = 5;
|
||||
|
||||
|
|
|
@ -50,6 +50,20 @@ export default (filterArg, params) => {
|
|||
modelParams.category_slug_path_with_id
|
||||
);
|
||||
|
||||
if (!category) {
|
||||
const parts = modelParams.category_slug_path_with_id.split("/");
|
||||
if (parts.length > 0 && parts[parts.length - 1].match(/^\d+$/)) {
|
||||
parts.pop();
|
||||
}
|
||||
|
||||
return Category.reloadBySlugPath(parts.join("/")).then(result => {
|
||||
const record = this.store.createRecord("category", result.category);
|
||||
record.setupGroupsAndPermissions();
|
||||
this.site.updateCategory(record);
|
||||
return { category: record };
|
||||
});
|
||||
}
|
||||
|
||||
if (category) {
|
||||
return { category };
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user