DEV: Replace deprecated API calls
This commit is contained in:
parent
5e756f57da
commit
698218c37b
|
@ -1,8 +1,8 @@
|
|||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
|
||||
export default Ember.Component.extend({
|
||||
tagName: "",
|
||||
@computed("category")
|
||||
@discourseComputed("category")
|
||||
categoryName(category) {
|
||||
return this.site.categories.findBy("id", category.id).name;
|
||||
},
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Category from "discourse/models/category";
|
||||
import { on } from "discourse-common/utils/decorators";
|
||||
import KnowledgeExplorer from "discourse/plugins/discourse-knowledge-explorer/discourse/models/knowledge-explorer";
|
||||
|
||||
function mergeCategories(results) {
|
||||
const categories = Discourse.Category.list();
|
||||
const categories = Category.list();
|
||||
const topics = results.topics.topic_list.topics.map(t => {
|
||||
t.category = categories.findBy("id", t.category_id);
|
||||
return t;
|
||||
|
@ -43,7 +44,7 @@ export default Ember.Controller.extend({
|
|||
}
|
||||
},
|
||||
|
||||
@computed("loadMoreUrl")
|
||||
@discourseComputed("loadMoreUrl")
|
||||
canLoadMore(loadMoreUrl) {
|
||||
if (loadMoreUrl === null || this.isLoadingMore) {
|
||||
return false;
|
||||
|
@ -51,19 +52,19 @@ export default Ember.Controller.extend({
|
|||
return true;
|
||||
},
|
||||
|
||||
@computed("searchTerm")
|
||||
@discourseComputed("searchTerm")
|
||||
isSearching(searchTerm) {
|
||||
return !!searchTerm;
|
||||
},
|
||||
|
||||
@computed("isSearching", "topics")
|
||||
@discourseComputed("isSearching", "topics")
|
||||
searchCount(isSearching, topics) {
|
||||
if (isSearching) return topics.length;
|
||||
},
|
||||
|
||||
emptySearchResults: Ember.computed.equal("searchCount", 0),
|
||||
|
||||
@computed("filterTags")
|
||||
@discourseComputed("filterTags")
|
||||
filtered(filterTags) {
|
||||
return !!filterTags;
|
||||
},
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import Category from "discourse/models/category";
|
||||
import KnowledgeExplorer from "discourse/plugins/discourse-knowledge-explorer/discourse/models/knowledge-explorer";
|
||||
|
||||
export default Ember.Route.extend({
|
||||
|
@ -12,7 +13,7 @@ export default Ember.Route.extend({
|
|||
},
|
||||
|
||||
setupController(controller, model) {
|
||||
const categories = Discourse.Category.list();
|
||||
const categories = Category.list();
|
||||
|
||||
let topics = model.topics.topic_list.topics;
|
||||
|
||||
|
|
Loading…
Reference in New Issue