FIX: on load categories list not showing create button

This commit is contained in:
Sam 2016-08-31 09:35:23 +10:00
parent 329faae3e0
commit 591dab1bb5

View file

@ -40,12 +40,13 @@ const DiscoveryCategoriesRoute = Discourse.Route.extend(OpenComposer, {
}, },
_loadCategoriesAndLatestTopics() { _loadCategoriesAndLatestTopics() {
const categoriesList = PreloadStore.get("categories_list"); const wrappedCategoriesList = PreloadStore.get("categories_list");
const topicListLatest = PreloadStore.get("topic_list_latest"); const topicListLatest = PreloadStore.get("topic_list_latest");
const categoriesList = wrappedCategoriesList && wrappedCategoriesList.categories_list;
if (categoriesList && topicListLatest) { if (categoriesList && topicListLatest) {
return new Ember.RSVP.Promise(resolve => { return new Ember.RSVP.Promise(resolve => {
const result = Ember.Object.create({ const result = Ember.Object.create({
categories: CategoryList.categoriesFrom(this.store, categoriesList), categories: CategoryList.categoriesFrom(this.store, wrappedCategoriesList),
topics: TopicList.topicsFrom(this.store, topicListLatest), topics: TopicList.topicsFrom(this.store, topicListLatest),
can_create_category: categoriesList.can_create_category, can_create_category: categoriesList.can_create_category,
can_create_topic: categoriesList.can_create_topic, can_create_topic: categoriesList.can_create_topic,