DEV: Replace deprecated API calls

This commit is contained in:
Justin DiRose 2019-11-13 11:01:24 -06:00
parent 5e756f57da
commit 698218c37b
3 changed files with 11 additions and 9 deletions

View File

@ -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({ export default Ember.Component.extend({
tagName: "", tagName: "",
@computed("category") @discourseComputed("category")
categoryName(category) { categoryName(category) {
return this.site.categories.findBy("id", category.id).name; return this.site.categories.findBy("id", category.id).name;
}, },

View File

@ -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 { on } from "discourse-common/utils/decorators";
import KnowledgeExplorer from "discourse/plugins/discourse-knowledge-explorer/discourse/models/knowledge-explorer"; import KnowledgeExplorer from "discourse/plugins/discourse-knowledge-explorer/discourse/models/knowledge-explorer";
function mergeCategories(results) { function mergeCategories(results) {
const categories = Discourse.Category.list(); const categories = Category.list();
const topics = results.topics.topic_list.topics.map(t => { const topics = results.topics.topic_list.topics.map(t => {
t.category = categories.findBy("id", t.category_id); t.category = categories.findBy("id", t.category_id);
return t; return t;
@ -43,7 +44,7 @@ export default Ember.Controller.extend({
} }
}, },
@computed("loadMoreUrl") @discourseComputed("loadMoreUrl")
canLoadMore(loadMoreUrl) { canLoadMore(loadMoreUrl) {
if (loadMoreUrl === null || this.isLoadingMore) { if (loadMoreUrl === null || this.isLoadingMore) {
return false; return false;
@ -51,19 +52,19 @@ export default Ember.Controller.extend({
return true; return true;
}, },
@computed("searchTerm") @discourseComputed("searchTerm")
isSearching(searchTerm) { isSearching(searchTerm) {
return !!searchTerm; return !!searchTerm;
}, },
@computed("isSearching", "topics") @discourseComputed("isSearching", "topics")
searchCount(isSearching, topics) { searchCount(isSearching, topics) {
if (isSearching) return topics.length; if (isSearching) return topics.length;
}, },
emptySearchResults: Ember.computed.equal("searchCount", 0), emptySearchResults: Ember.computed.equal("searchCount", 0),
@computed("filterTags") @discourseComputed("filterTags")
filtered(filterTags) { filtered(filterTags) {
return !!filterTags; return !!filterTags;
}, },

View File

@ -1,3 +1,4 @@
import Category from "discourse/models/category";
import KnowledgeExplorer from "discourse/plugins/discourse-knowledge-explorer/discourse/models/knowledge-explorer"; import KnowledgeExplorer from "discourse/plugins/discourse-knowledge-explorer/discourse/models/knowledge-explorer";
export default Ember.Route.extend({ export default Ember.Route.extend({
@ -12,7 +13,7 @@ export default Ember.Route.extend({
}, },
setupController(controller, model) { setupController(controller, model) {
const categories = Discourse.Category.list(); const categories = Category.list();
let topics = model.topics.topic_list.topics; let topics = model.topics.topic_list.topics;