diff --git a/app/assets/javascripts/discourse/models/composer.js.es6 b/app/assets/javascripts/discourse/models/composer.js.es6 index 839190d6f54..44a6ece3944 100644 --- a/app/assets/javascripts/discourse/models/composer.js.es6 +++ b/app/assets/javascripts/discourse/models/composer.js.es6 @@ -304,6 +304,21 @@ const Composer = RestModel.extend({ Discourse.KeyValueStore.set({ key: 'composer.showPreview', value: this.get('showPreview') }); }, + applyTopicTemplate: function() { + if (this.get('action') !== CREATE_TOPIC) { return; } + if (!Ember.isEmpty(this.get('reply'))) { return; } + + const categoryId = this.get('categoryId'); + const category = this.site.categories.find((c) => c.get('id') === categoryId); + if (category) { + const topicTemplate = category.get('topic_template'); + if (!Ember.isEmpty(topicTemplate)) { + this.set('reply', topicTemplate); + } + } + + }.observes('categoryId'), + /* Open a composer @@ -354,16 +369,6 @@ const Composer = RestModel.extend({ reply: opts.reply || this.get("reply") || "" }); - if (opts.action === CREATE_TOPIC && categoryId) { - const category = this.site.categories.find((c) => c.get('id') === categoryId); - if (category) { - const topicTemplate = category.get('topic_template'); - if (!Ember.isEmpty(topicTemplate)) { - this.set('reply', topicTemplate); - } - } - } - if (opts.postId) { this.set('loading', true); this.store.find('post', opts.postId).then(function(post) {