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

This commit is contained in:
Joffrey JAFFEUX 2019-07-23 17:05:49 +02:00 committed by GitHub
parent 4bc5ccf7e4
commit 8a9ce7336d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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