REFACTOR: Remove Ember.get

This commit is contained in:
Robin Ward
2019-10-31 16:28:10 -04:00
parent 89f602f66b
commit 640a05c4ee
31 changed files with 84 additions and 56 deletions
@@ -1,3 +1,4 @@
import { get } from "@ember/object";
import { makeArray } from "discourse/lib/utilities";
import MultiSelectComponent from "select-kit/components/multi-select";
import Category from "discourse/models/category";
@@ -39,7 +40,7 @@ export default MultiSelectComponent.extend({
filterComputedContent(computedContent, computedValues, filter) {
const regex = new RegExp(filter, "i");
return computedContent.filter(category =>
this._normalize(Ember.get(category, "name")).match(regex)
this._normalize(get(category, "name")).match(regex)
);
},
@@ -1,3 +1,5 @@
import { isEmpty } from "@ember/utils";
import { get } from "@ember/object";
import { makeArray } from "discourse/lib/utilities";
import Category from "discourse/models/category";
import ComboBox from "select-kit/components/combo-box";
@@ -6,7 +8,6 @@ import { default as computed } from "ember-addons/ember-computed-decorators";
import renderTag from "discourse/lib/render-tag";
import { escapeExpression } from "discourse/lib/utilities";
import { iconHTML } from "discourse-common/lib/icon-library";
const { get, isEmpty, run } = Ember;
export default ComboBox.extend(TagsMixin, {
allowContentReplacement: true,
@@ -168,9 +169,7 @@ export default ComboBox.extend(TagsMixin, {
computeHeaderContent() {
let content = this._super(...arguments);
const joinedTags = this.selection
.map(s => Ember.get(s, "value"))
.join(", ");
const joinedTags = this.selection.map(s => get(s, "value")).join(", ");
if (isEmpty(this.selection)) {
content.label = I18n.t("tagging.choose_for_topic");
@@ -198,7 +197,7 @@ export default ComboBox.extend(TagsMixin, {
if (this.selection) {
data.selected_tags = this.selection
.map(s => Ember.get(s, "value"))
.map(s => get(s, "value"))
.slice(0, 100);
}