DEV: Import makeArray from discourse-common instead using Ember global (#8977)

This commit is contained in:
Jarek Radosz 2020-02-19 00:57:58 +01:00 committed by GitHub
parent 25ebfd5998
commit 9f8a27a132
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 7 deletions

View File

@ -81,7 +81,7 @@ export default SelectKitComponent.extend({
},
selectedContent: computed("value.[]", "content.[]", function() {
const value = Ember.makeArray(this.value).map(v =>
const value = makeArray(this.value).map(v =>
this.selectKit.options.castInteger && this._isNumeric(v) ? Number(v) : v
);

View File

@ -1,5 +1,6 @@
import SelectKitHeaderComponent from "select-kit/components/select-kit/select-kit-header";
import { computed } from "@ember/object";
import { makeArray } from "discourse-common/lib/helpers";
export default SelectKitHeaderComponent.extend({
classNames: ["multi-select-header"],
@ -7,11 +8,11 @@ export default SelectKitHeaderComponent.extend({
"select-kit/templates/components/multi-select/multi-select-header",
selectedNames: computed("selectedContent", function() {
return Ember.makeArray(this.selectedContent).map(c => this.getName(c));
return makeArray(this.selectedContent).map(c => this.getName(c));
}),
selectedValue: computed("selectedContent", function() {
return Ember.makeArray(this.selectedContent)
return makeArray(this.selectedContent)
.map(c => {
if (this.getName(c) !== this.getName(this.selectKit.noneItem)) {
return this.getValue(c);

View File

@ -318,7 +318,7 @@ export default Component.extend(
validateSelect() {
this.clearErrors();
const selection = Ember.makeArray(this.value);
const selection = makeArray(this.value);
const maximum = this.selectKit.options.maximum;
if (maximum && selection.length >= maximum) {

View File

@ -28,7 +28,7 @@ export default MultiSelectComponent.extend({
},
content: computed("value.[]", function() {
return Ember.makeArray(this.value).map(x => this.defaultItem(x, x));
return makeArray(this.value).map(x => this.defaultItem(x, x));
}),
excludedUsers: computed(

View File

@ -1,5 +1,6 @@
import Mixin from "@ember/object/mixin";
import { isNone } from "@ember/utils";
import { makeArray } from "discourse-common/lib/helpers";
let _appendContentCallbacks = {};
function appendContent(pluginApiIdentifiers, contentFunction) {
@ -109,10 +110,10 @@ export function applyContentPluginApiCallbacks(
) {
identifiers.forEach(key => {
(_prependContentCallbacks[key] || []).forEach(c => {
content = Ember.makeArray(c(selectKit, content)).concat(content);
content = makeArray(c(selectKit, content)).concat(content);
});
(_appendContentCallbacks[key] || []).forEach(c => {
content = content.concat(Ember.makeArray(c(selectKit, content)));
content = content.concat(makeArray(c(selectKit, content)));
});
const filterCallbacks = _filterContentCallbacks[key] || [];
if (filterCallbacks.length) {