mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
REFACTOR: Use a module for Ember.isEmpty
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { isEmpty } from "@ember/utils";
|
||||
import EmberObject from "@ember/object";
|
||||
import { escapeExpression } from "discourse/lib/utilities";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
@@ -392,7 +393,7 @@ const Report = Discourse.Model.extend({
|
||||
},
|
||||
|
||||
_numberLabel(value, options = {}) {
|
||||
const formatNumbers = Ember.isEmpty(options.formatNumbers)
|
||||
const formatNumbers = isEmpty(options.formatNumbers)
|
||||
? true
|
||||
: options.formatNumbers;
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { isEmpty } from "@ember/utils";
|
||||
import { or, gt } from "@ember/object/computed";
|
||||
import RestModel from "discourse/models/rest";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
@@ -161,11 +162,11 @@ const Theme = RestModel.extend({
|
||||
|
||||
hasEdited(target, name) {
|
||||
if (name) {
|
||||
return !Ember.isEmpty(this.getField(target, name));
|
||||
return !isEmpty(this.getField(target, name));
|
||||
} else {
|
||||
let fields = this.theme_fields || [];
|
||||
return fields.any(
|
||||
field => field.target === target && !Ember.isEmpty(field.value)
|
||||
field => field.target === target && !isEmpty(field.value)
|
||||
);
|
||||
}
|
||||
},
|
||||
@@ -227,8 +228,8 @@ const Theme = RestModel.extend({
|
||||
themeFields[key] = field;
|
||||
} else {
|
||||
const changed =
|
||||
(Ember.isEmpty(existingField.value) && !Ember.isEmpty(value)) ||
|
||||
(Ember.isEmpty(value) && !Ember.isEmpty(existingField.value));
|
||||
(isEmpty(existingField.value) && !isEmpty(value)) ||
|
||||
(isEmpty(value) && !isEmpty(existingField.value));
|
||||
|
||||
existingField.value = value;
|
||||
if (changed) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { isEmpty } from "@ember/utils";
|
||||
import RestModel from "discourse/models/rest";
|
||||
import Category from "discourse/models/category";
|
||||
import Group from "discourse/models/group";
|
||||
@@ -78,13 +79,13 @@ export default RestModel.extend({
|
||||
wildcard_web_hook: this.wildcard_web_hook,
|
||||
verify_certificate: this.verify_certificate,
|
||||
active: this.active,
|
||||
web_hook_event_type_ids: Ember.isEmpty(types)
|
||||
web_hook_event_type_ids: isEmpty(types)
|
||||
? [null]
|
||||
: types.map(type => type.id),
|
||||
category_ids: Ember.isEmpty(categoryIds) ? [null] : categoryIds,
|
||||
tag_names: Ember.isEmpty(tagNames) ? [null] : tagNames,
|
||||
category_ids: isEmpty(categoryIds) ? [null] : categoryIds,
|
||||
tag_names: isEmpty(tagNames) ? [null] : tagNames,
|
||||
group_ids:
|
||||
Ember.isEmpty(groupNames) || Ember.isEmpty(groupNames[0])
|
||||
isEmpty(groupNames) || isEmpty(groupNames[0])
|
||||
? [null]
|
||||
: Discourse.Site.currentProp("groups").reduce((groupIds, g) => {
|
||||
if (groupNames.includes(g.name)) {
|
||||
|
||||
Reference in New Issue
Block a user