From 4dfe5fd1ca7b8201fbfd3e93f11c28ca94f2e1f1 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Thu, 14 Aug 2014 10:56:47 -0400 Subject: [PATCH] FIX: Edit category should use the id always in case two categories have the same slug. --- app/assets/javascripts/discourse/models/category.js | 5 ++--- app/assets/javascripts/discourse/routes/application.js.es6 | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/discourse/models/category.js b/app/assets/javascripts/discourse/models/category.js index f19c5b930c9..49071428f40 100644 --- a/app/assets/javascripts/discourse/models/category.js +++ b/app/assets/javascripts/discourse/models/category.js @@ -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); }); } diff --git a/app/assets/javascripts/discourse/routes/application.js.es6 b/app/assets/javascripts/discourse/routes/application.js.es6 index 72484332d02..e37aff147e3 100644 --- a/app/assets/javascripts/discourse/routes/application.js.es6 +++ b/app/assets/javascripts/discourse/routes/application.js.es6 @@ -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');