FIX: Show detailed error messages for category pages. (#8832)

This commit is contained in:
Dan Ungureanu 2020-02-06 06:32:12 +02:00 committed by GitHub
parent 3bf870cb24
commit 2240b1681b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 0 deletions

View File

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

View File

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