DEV: allows to import isPresent (#8993)

This commit is contained in:
Joffrey JAFFEUX 2020-02-18 23:41:15 +01:00 committed by GitHub
parent 8f82d790d4
commit 25ebfd5998
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 7 deletions

View File

@ -80,6 +80,7 @@ var define, requirejs;
inject: Ember.inject.service
},
"@ember/utils": {
isPresent: Ember.isPresent,
isEmpty: Ember.isEmpty,
isNone: Ember.isNone
},

View File

@ -1,4 +1,4 @@
import { isEmpty } from "@ember/utils";
import { isPresent, isEmpty } from "@ember/utils";
import { or, and, not, alias } from "@ember/object/computed";
import EmberObject from "@ember/object";
import { next } from "@ember/runloop";
@ -1299,7 +1299,7 @@ export default Controller.extend(bufferedProperty("model"), {
data => {
const topic = this.model;
if (Ember.isPresent(data.notification_level_change)) {
if (isPresent(data.notification_level_change)) {
topic.set(
"details.notification_level",
data.notification_level_change

View File

@ -2,6 +2,7 @@ import deprecated from "discourse-common/lib/deprecated";
import SelectKitComponent from "select-kit/components/select-kit";
import { computed } from "@ember/object";
import { makeArray } from "discourse-common/lib/helpers";
import { isPresent } from "@ember/utils";
export default SelectKitComponent.extend({
pluginApiIdentifiers: ["multi-select"],
@ -41,7 +42,7 @@ export default SelectKitComponent.extend({
},
select(value, item) {
if (!Ember.isPresent(value)) {
if (!isPresent(value)) {
if (!this.validateSelect(this.selectKit.highlighted)) {
return;
}

View File

@ -6,7 +6,7 @@ import { get } from "@ember/object";
import UtilsMixin from "select-kit/mixins/utils";
import PluginApiMixin from "select-kit/mixins/plugin-api";
import Mixin from "@ember/object/mixin";
import { isEmpty, isNone } from "@ember/utils";
import { isPresent, isEmpty, isNone } from "@ember/utils";
import {
next,
debounce,
@ -422,8 +422,8 @@ export default Component.extend(
}
if (this.singleSelect) {
value = Ember.isPresent(value.firstObject) ? value.firstObject : null;
items = Ember.isPresent(items.firstObject) ? items.firstObject : null;
value = isPresent(value.firstObject) ? value.firstObject : null;
items = isPresent(items.firstObject) ? items.firstObject : null;
}
this._boundaryActionHandler("onChange", value, items);
@ -704,7 +704,7 @@ export default Component.extend(
},
select(value, item) {
if (!Ember.isPresent(value)) {
if (!isPresent(value)) {
if (!this.validateSelect(this.selectKit.highlighted)) {
return;
}