FIX: Edit category should use the id always in case two categories have

the same slug.
This commit is contained in:
Robin Ward 2014-08-14 10:56:47 -04:00
parent a23b6f24cf
commit 4dfe5fd1ca
2 changed files with 3 additions and 4 deletions

View File

@ -240,7 +240,6 @@ Discourse.Category.reopenClass({
},
findBySlug: function(slug, parentSlug) {
var categories = Discourse.Category.list(),
category;
@ -268,8 +267,8 @@ Discourse.Category.reopenClass({
return category;
},
reloadBySlugOrId: function(slugOrId) {
return Discourse.ajax("/category/" + slugOrId + "/show.json").then(function (result) {
reloadById: function(id) {
return Discourse.ajax("/category/" + id + "/show.json").then(function (result) {
return Discourse.Category.create(result.category);
});
}

View File

@ -114,7 +114,7 @@ var ApplicationRoute = Em.Route.extend({
Discourse.Route.showModal(router, 'editCategory', category);
router.controllerFor('editCategory').set('selectedTab', 'general');
} else {
Discourse.Category.reloadBySlugOrId(category.get('slug') || category.get('id')).then(function (c) {
Discourse.Category.reloadById(category.get('id')).then(function (c) {
Discourse.Site.current().updateCategory(c);
Discourse.Route.showModal(router, 'editCategory', c);
router.controllerFor('editCategory').set('selectedTab', 'general');