From 560cc4e73eea808145839f5a9f6e86429a86dcbd Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Wed, 13 Feb 2019 15:19:58 +0100 Subject: [PATCH] FIX: sets categoryId but do not scope when replying as new topic (#7002) --- .../javascripts/discourse/controllers/composer.js.es6 | 6 +++++- .../select-kit/components/composer-actions.js.es6 | 8 +++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/controllers/composer.js.es6 b/app/assets/javascripts/discourse/controllers/composer.js.es6 index 6760e0279b7..aa077e74676 100644 --- a/app/assets/javascripts/discourse/controllers/composer.js.es6 +++ b/app/assets/javascripts/discourse/controllers/composer.js.es6 @@ -783,7 +783,11 @@ export default Ember.Controller.extend({ }); // Scope the categories drop down to the category we opened the composer with. - if (opts.categoryId && opts.draftKey !== "reply_as_new_topic") { + if ( + opts.categoryId && + opts.draftKey !== "reply_as_new_topic" && + !opts.disableScopedCategory + ) { const category = this.site.categories.findBy("id", opts.categoryId); if (category) { this.set("scopedCategoryId", opts.categoryId); diff --git a/app/assets/javascripts/select-kit/components/composer-actions.js.es6 b/app/assets/javascripts/select-kit/components/composer-actions.js.es6 index 0fe64b0cc77..e78aa7fbfc3 100644 --- a/app/assets/javascripts/select-kit/components/composer-actions.js.es6 +++ b/app/assets/javascripts/select-kit/components/composer-actions.js.es6 @@ -242,6 +242,7 @@ export default DropdownSelectBoxComponent.extend({ replyAsNewTopicSelected(options) { options.action = CREATE_TOPIC; options.categoryId = this.get("composerModel.topic.category.id"); + options.disableScopedCategory = true; this._replyFromExisting(options, _postSnapshot, _topicSnapshot); }, @@ -295,7 +296,12 @@ export default DropdownSelectBoxComponent.extend({ if (this[action]) { let model = this.get("composerModel"); this[action]( - model.getProperties("draftKey", "draftSequence", "reply"), + model.getProperties( + "draftKey", + "draftSequence", + "reply", + "disableScopedCategory" + ), model ); } else {