diff --git a/app/assets/javascripts/discourse/controllers/composer.js.es6 b/app/assets/javascripts/discourse/controllers/composer.js.es6 index fd1eb0d2789..65df35cae1f 100644 --- a/app/assets/javascripts/discourse/controllers/composer.js.es6 +++ b/app/assets/javascripts/discourse/controllers/composer.js.es6 @@ -439,11 +439,8 @@ export default DiscourseController.extend({ this.set('model.title', opts.topicTitle); } - if (opts.topicCategory) { - var category = Discourse.Category.list().findProperty('name', opts.topicCategory); - if (category && category.id) { - this.set('model.categoryId', category.id); - } + if (opts.topicCategoryId) { + this.set('model.categoryId', opts.topicCategoryId); } if (opts.topicBody) { diff --git a/app/assets/javascripts/discourse/mixins/open_composer.js b/app/assets/javascripts/discourse/mixins/open_composer.js index 58acafb6f99..64a79f7965d 100644 --- a/app/assets/javascripts/discourse/mixins/open_composer.js +++ b/app/assets/javascripts/discourse/mixins/open_composer.js @@ -17,12 +17,12 @@ Discourse.OpenComposer = Em.Mixin.create({ }); }, - openComposerWithParams: function(controller, title, body, category) { + openComposerWithParams: function(controller, title, body, category_id) { this.controllerFor('composer').open({ action: Discourse.Composer.CREATE_TOPIC, topicTitle: title, topicBody: body, - topicCategory: category, + topicCategoryId: category_id, draftKey: controller.get('draft_key'), draftSequence: controller.get('draft_sequence') }); diff --git a/app/assets/javascripts/discourse/routes/application.js.es6 b/app/assets/javascripts/discourse/routes/application.js.es6 index 82078b6859f..4e6a61e1c01 100644 --- a/app/assets/javascripts/discourse/routes/application.js.es6 +++ b/app/assets/javascripts/discourse/routes/application.js.es6 @@ -148,8 +148,8 @@ const ApplicationRoute = Discourse.Route.extend(Discourse.OpenComposer, { this.render(w, {into: 'modal/topic-bulk-actions', outlet: 'bulkOutlet', controller: factory ? controllerName : 'topic-bulk-actions'}); }, - createNewTopicViaParams: function(title, body, category) { - this.openComposerWithParams(this.controllerFor('discovery/topics'), title, body, category); + createNewTopicViaParams: function(title, body, category_id) { + this.openComposerWithParams(this.controllerFor('discovery/topics'), title, body, category_id); } }, diff --git a/app/assets/javascripts/discourse/routes/new-topic.js.es6 b/app/assets/javascripts/discourse/routes/new-topic.js.es6 index c6c0ebcee55..f09dcae0289 100644 --- a/app/assets/javascripts/discourse/routes/new-topic.js.es6 +++ b/app/assets/javascripts/discourse/routes/new-topic.js.es6 @@ -7,7 +7,7 @@ export default Discourse.Route.extend({ if (self.controllerFor('navigation/default').get('canCreateTopic')) { // User can create topic Ember.run.next(function() { - e.send('createNewTopicViaParams', transition.queryParams.title, transition.queryParams.body, transition.queryParams.category); + e.send('createNewTopicViaParams', transition.queryParams.title, transition.queryParams.body, transition.queryParams.category_id); }); } });