FIX: Edit category should use the id always in case two categories have
the same slug.
This commit is contained in:
parent
a23b6f24cf
commit
4dfe5fd1ca
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
|
|
Loading…
Reference in New Issue