Skip to content

A platform for community discussion. Free, open, simple.

FIX: removes uncategorized context if not allowed in composer (#7922)

Joffrey JAFFEUX8a9ce7336d0e
diff --git a/app/assets/javascripts/discourse/mixins/open-composer.js.es6 b/app/assets/javascripts/discourse/mixins/open-composer.js.es6
index e3576cda08c..7d925ab652a 100644
--- a/app/assets/javascripts/discourse/mixins/open-composer.js.es6
+++ b/app/assets/javascripts/discourse/mixins/open-composer.js.es6
@@ -3,8 +3,17 @@ import Composer from "discourse/models/composer";
export default Ember.Mixin.create({
openComposer(controller) {
+ let categoryId = controller.get("category.id");
+ if (
+ categoryId &&
+ controller.category.isUncategorizedCategory &&
+ !this.siteSettings.allow_uncategorized_topics
+ ) {
+ categoryId = null;
+ }
+
this.controllerFor("composer").open({
- categoryId: controller.get("category.id"),
+ categoryId,
action: Composer.CREATE_TOPIC,
draftKey: controller.get("model.draft_key") || Composer.CREATE_TOPIC,
draftSequence: controller.get("model.draft_sequence") || 0