FIX: show 404 page for links to categories that don't exists or you don't have access to, instead of showing blank page with js errors

This commit is contained in:
Neil Lalonde 2014-06-19 15:18:47 -04:00
parent b4b992299d
commit 12a0260a8c
1 changed files with 5 additions and 0 deletions

View File

@ -99,6 +99,11 @@ function buildCategoryRoute(filter, params) {
},
afterModel: function(model, transaction) {
if (!model) {
this.replaceWith('/404');
return;
}
var self = this,
noSubcategories = params && !!params.no_subcategories,
filterMode = "category/" + Discourse.Category.slugFor(model) + (noSubcategories ? "/none" : "") + "/l/" + filter,