Skip to content

Commit

Permalink
FIX: Move makeArray to discourse-common
Browse files Browse the repository at this point in the history
  • Loading branch information
eviltrout committed Nov 1, 2019
1 parent 6300ac6 commit dceb72b
Show file tree
Hide file tree
Showing 17 changed files with 23 additions and 22 deletions.
@@ -1,4 +1,4 @@
import { makeArray } from "discourse/lib/utilities";
import { makeArray } from "discourse-common/lib/helpers";
import { debounce } from "@ember/runloop";
import { schedule } from "@ember/runloop";
import Component from "@ember/component";
Expand Down
@@ -1,4 +1,4 @@
import { makeArray } from "discourse/lib/utilities";
import { makeArray } from "discourse-common/lib/helpers";
import { debounce } from "@ember/runloop";
import { schedule } from "@ember/runloop";
import Component from "@ember/component";
Expand Down
@@ -1,4 +1,4 @@
import { makeArray } from "discourse/lib/utilities";
import { makeArray } from "discourse-common/lib/helpers";
import { alias } from "@ember/object/computed";
import Component from "@ember/component";
import computed from "ember-addons/ember-computed-decorators";
Expand Down
@@ -1,4 +1,4 @@
import { makeArray } from "discourse/lib/utilities";
import { makeArray } from "discourse-common/lib/helpers";
import { alias, or, and, reads, equal, notEmpty } from "@ember/object/computed";
import EmberObject from "@ember/object";
import { next } from "@ember/runloop";
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/admin/components/value-list.js.es6
@@ -1,4 +1,4 @@
import { makeArray } from "discourse/lib/utilities";
import { makeArray } from "discourse-common/lib/helpers";
import { empty, alias } from "@ember/object/computed";
import Component from "@ember/component";
import { on } from "ember-addons/ember-computed-decorators";
Expand Down
@@ -1,4 +1,4 @@
import { makeArray } from "discourse/lib/utilities";
import { makeArray } from "discourse-common/lib/helpers";
import { empty, notEmpty, match } from "@ember/object/computed";
import Controller from "@ember/controller";
import { default as computed } from "ember-addons/ember-computed-decorators";
Expand Down
@@ -1,4 +1,4 @@
import { makeArray } from "discourse/lib/utilities";
import { makeArray } from "discourse-common/lib/helpers";
import { inject } from "@ember/controller";
import Controller from "@ember/controller";
import { setting } from "discourse/lib/computed";
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/admin/models/report.js.es6
@@ -1,4 +1,4 @@
import { makeArray } from "discourse/lib/utilities";
import { makeArray } from "discourse-common/lib/helpers";
import { isEmpty } from "@ember/utils";
import EmberObject from "@ember/object";
import { escapeExpression } from "discourse/lib/utilities";
Expand Down
7 changes: 7 additions & 0 deletions app/assets/javascripts/discourse-common/lib/helpers.js.es6
@@ -1,5 +1,12 @@
import { get } from "@ember/object";

export function makeArray(obj) {
if (obj === null || obj === undefined) {
return [];
}
return Array.isArray(obj) ? obj : [obj];
}

export function htmlHelper(fn) {
return Ember.Helper.helper(function(...args) {
args =
Expand Down
7 changes: 0 additions & 7 deletions app/assets/javascripts/discourse/lib/utilities.js.es6
Expand Up @@ -3,13 +3,6 @@ import toMarkdown from "discourse/lib/to-markdown";

const homepageSelector = "meta[name=discourse_current_homepage]";

export function makeArray(obj) {
if (obj === null || obj === undefined) {
return [];
}
return Array.isArray(obj) ? obj : [obj];
}

export function translateSize(size) {
switch (size) {
case "tiny":
Expand Down
@@ -1,4 +1,4 @@
import { makeArray } from "discourse/lib/utilities";
import { makeArray } from "discourse-common/lib/helpers";
import { createWidget } from "discourse/widgets/widget";
import { h } from "virtual-dom";
import { avatarFor, avatarImg } from "discourse/widgets/post";
Expand Down
@@ -1,5 +1,5 @@
import { get } from "@ember/object";
import { makeArray } from "discourse/lib/utilities";
import { makeArray } from "discourse-common/lib/helpers";
import MultiSelectComponent from "select-kit/components/multi-select";
import Category from "discourse/models/category";

Expand Down
Expand Up @@ -3,7 +3,8 @@ import ComboBox from "select-kit/components/combo-box";
import TagsMixin from "select-kit/mixins/tags";
import { default as computed } from "ember-addons/ember-computed-decorators";
import renderTag from "discourse/lib/render-tag";
import { escapeExpression, makeArray } from "discourse/lib/utilities";
import { escapeExpression } from "discourse/lib/utilities";
import { makeArray } from "discourse-common/lib/helpers";
import { iconHTML } from "discourse-common/lib/icon-library";
import { get } from "@ember/object";
import { isEmpty } from "@ember/utils";
Expand Down
@@ -1,4 +1,4 @@
import { makeArray } from "discourse/lib/utilities";
import { makeArray } from "discourse-common/lib/helpers";
import { on } from "ember-addons/ember-computed-decorators";
import computed from "ember-addons/ember-computed-decorators";
import SelectKitHeaderComponent from "select-kit/components/select-kit/select-kit-header";
Expand Down
Expand Up @@ -2,7 +2,7 @@ import MultiSelectComponent from "select-kit/components/multi-select";
import TagsMixin from "select-kit/mixins/tags";
import renderTag from "discourse/lib/render-tag";
import computed from "ember-addons/ember-computed-decorators";
import { makeArray } from "discourse/lib/utilities";
import { makeArray } from "discourse-common/lib/helpers";
const { get, run } = Ember;

export default MultiSelectComponent.extend(TagsMixin, {
Expand Down
@@ -1,4 +1,4 @@
import { makeArray } from "discourse/lib/utilities";
import { makeArray } from "discourse-common/lib/helpers";
import ComboBoxComponent from "select-kit/components/combo-box";
import DiscourseURL from "discourse/lib/url";
import TagsMixin from "select-kit/mixins/tags";
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/select-kit/mixins/events.js.es6
@@ -1,5 +1,5 @@
import { get } from "@ember/object";
import { makeArray } from "discourse/lib/utilities";
import { makeArray } from "discourse-common/lib/helpers";
import { isEmpty } from "@ember/utils";
import { throttle } from "@ember/runloop";
import { schedule } from "@ember/runloop";
Expand Down

0 comments on commit dceb72b

Please sign in to comment.