FIX: make update banner always available on the categories view (#14431)
This commit is contained in:
parent
8115e5ef76
commit
fd0e287da6
|
@ -43,37 +43,14 @@ const DiscoveryCategoriesRoute = DiscourseRoute.extend(OpenComposer, {
|
|||
return model;
|
||||
});
|
||||
},
|
||||
|
||||
_findCategoriesAndTopics(filter) {
|
||||
return hash({
|
||||
wrappedCategoriesList: PreloadStore.getAndRemove("categories_list"),
|
||||
topicsList: PreloadStore.getAndRemove(`topic_list_${filter}`),
|
||||
}).then((response) => {
|
||||
let { wrappedCategoriesList, topicsList } = response;
|
||||
let categoriesList =
|
||||
wrappedCategoriesList && wrappedCategoriesList.category_list;
|
||||
|
||||
if (categoriesList && topicsList) {
|
||||
if (topicsList.topic_list && topicsList.topic_list.top_tags) {
|
||||
Site.currentProp("top_tags", topicsList.topic_list.top_tags);
|
||||
}
|
||||
|
||||
let store = this.store;
|
||||
|
||||
return EmberObject.create({
|
||||
categories: CategoryList.categoriesFrom(
|
||||
this.store,
|
||||
wrappedCategoriesList
|
||||
),
|
||||
loadBefore: function (topic_ids, storeInSession) {
|
||||
_loadBefore(store) {
|
||||
return function (topic_ids, storeInSession) {
|
||||
// refresh dupes
|
||||
this.topics.removeObjects(
|
||||
this.topics.filter((topic) => topic_ids.indexOf(topic.id) >= 0)
|
||||
);
|
||||
|
||||
const url = `${getURL("/")}latest.json?topic_ids=${topic_ids.join(
|
||||
","
|
||||
)}`;
|
||||
const url = `${getURL("/")}latest.json?topic_ids=${topic_ids.join(",")}`;
|
||||
|
||||
return ajax({ url, data: this.params }).then((result) => {
|
||||
const topicIds = [];
|
||||
|
@ -93,10 +70,32 @@ const DiscoveryCategoriesRoute = DiscourseRoute.extend(OpenComposer, {
|
|||
Session.currentProp("topicList", this);
|
||||
}
|
||||
});
|
||||
};
|
||||
},
|
||||
_findCategoriesAndTopics(filter) {
|
||||
return hash({
|
||||
wrappedCategoriesList: PreloadStore.getAndRemove("categories_list"),
|
||||
topicsList: PreloadStore.getAndRemove(`topic_list_${filter}`),
|
||||
}).then((response) => {
|
||||
let { wrappedCategoriesList, topicsList } = response;
|
||||
let categoriesList =
|
||||
wrappedCategoriesList && wrappedCategoriesList.category_list;
|
||||
let store = this.store;
|
||||
|
||||
if (categoriesList && topicsList) {
|
||||
if (topicsList.topic_list && topicsList.topic_list.top_tags) {
|
||||
Site.currentProp("top_tags", topicsList.topic_list.top_tags);
|
||||
}
|
||||
|
||||
return EmberObject.create({
|
||||
categories: CategoryList.categoriesFrom(
|
||||
this.store,
|
||||
wrappedCategoriesList
|
||||
),
|
||||
topics: TopicList.topicsFrom(this.store, topicsList),
|
||||
can_create_category: categoriesList.can_create_category,
|
||||
can_create_topic: categoriesList.can_create_topic,
|
||||
loadBefore: this._loadBefore(store),
|
||||
});
|
||||
}
|
||||
// Otherwise, return the ajax result
|
||||
|
@ -110,6 +109,7 @@ const DiscoveryCategoriesRoute = DiscourseRoute.extend(OpenComposer, {
|
|||
topics: TopicList.topicsFrom(this.store, result),
|
||||
can_create_category: result.category_list.can_create_category,
|
||||
can_create_topic: result.category_list.can_create_topic,
|
||||
loadBefore: this._loadBefore(store),
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue