From f6491ee125f9e198f9fd286a3fb185b4971d73a3 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Thu, 6 Jul 2017 16:01:57 +0900 Subject: [PATCH] FIX: Select topic timer's category by default in edit modal. --- .../discourse/components/category-chooser.js.es6 | 2 +- .../discourse/controllers/edit-topic-timer.js.es6 | 2 +- .../discourse/templates/modal/edit-topic-timer.hbs | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/discourse/components/category-chooser.js.es6 b/app/assets/javascripts/discourse/components/category-chooser.js.es6 index d0b8b45009a..dfc7cf51802 100644 --- a/app/assets/javascripts/discourse/components/category-chooser.js.es6 +++ b/app/assets/javascripts/discourse/components/category-chooser.js.es6 @@ -42,7 +42,7 @@ export default Combobox.extend({ @computed("rootNone", "rootNoneLabel") none(rootNone, rootNoneLabel) { - if (Discourse.SiteSettings.allow_uncategorized_topics || this.get('allowUncategorized')) { + if (this.siteSettings.allow_uncategorized_topics || this.get('allowUncategorized')) { if (rootNone) { return rootNoneLabel || "category.none"; } else { diff --git a/app/assets/javascripts/discourse/controllers/edit-topic-timer.js.es6 b/app/assets/javascripts/discourse/controllers/edit-topic-timer.js.es6 index 34f1b9cf66d..c04c3524e1d 100644 --- a/app/assets/javascripts/discourse/controllers/edit-topic-timer.js.es6 +++ b/app/assets/javascripts/discourse/controllers/edit-topic-timer.js.es6 @@ -70,7 +70,7 @@ export default Ember.Controller.extend(ModalFunctionality, { time, this.get('topicTimer.based_on_last_post'), statusType, - this.get('categoryId') + this.get('topicTimer.category_id') ).then(result => { if (time) { this.send('closeModal'); diff --git a/app/assets/javascripts/discourse/templates/modal/edit-topic-timer.hbs b/app/assets/javascripts/discourse/templates/modal/edit-topic-timer.hbs index 8668ba43a1b..6a1b4c24bee 100644 --- a/app/assets/javascripts/discourse/templates/modal/edit-topic-timer.hbs +++ b/app/assets/javascripts/discourse/templates/modal/edit-topic-timer.hbs @@ -13,13 +13,16 @@ {{else if publishToCategory}}
- {{category-chooser valueAttribute="id" value=categoryId excludeCategoryId=excludeCategoryId}} + {{category-chooser + valueAttribute="id" + value=topicTimer.category_id + excludeCategoryId=excludeCategoryId}}
{{auto-update-input input=updateTime statusType=selection - categoryId=categoryId + categoryId=topicTimer.category_id basedOnLastPost=false}} {{else if autoClose}} {{auto-update-input