REFACTOR: Use a module for `Ember.isEmpty`

This commit is contained in:
Robin Ward 2019-10-31 13:37:24 -04:00
parent 2b8a013e32
commit 90f934a660
85 changed files with 232 additions and 145 deletions

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { empty } from "@ember/object/computed";
import { scheduleOnce } from "@ember/runloop";
import Component from "@ember/component";
@ -96,7 +97,7 @@ export default Component.extend(bufferedProperty("userField"), {
cancel() {
const id = this.get("userField.id");
if (Ember.isEmpty(id)) {
if (isEmpty(id)) {
this.destroyAction(this.userField);
} else {
this.rollbackBuffer();

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { or } from "@ember/object/computed";
import { schedule } from "@ember/runloop";
import Component from "@ember/component";
@ -23,7 +24,7 @@ export default Component.extend(bufferedProperty("host"), {
@computed("buffered.host", "host.isSaving")
cantSave(host, isSaving) {
return isSaving || Ember.isEmpty(host);
return isSaving || isEmpty(host);
},
actions: {

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import Component from "@ember/component";
import { on } from "ember-addons/ember-computed-decorators";
@ -43,7 +44,7 @@ export default Component.extend({
_checkInvalidInput(inputs) {
this.set("validationMessage", null);
for (let input of inputs) {
if (Ember.isEmpty(input) || input.includes("|")) {
if (isEmpty(input) || input.includes("|")) {
this.set(
"validationMessage",
I18n.t("admin.site_settings.secret_list.invalid_input")

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import Component from "@ember/component";
import computed from "ember-addons/ember-computed-decorators";
@ -5,7 +6,7 @@ export default Component.extend({
@computed("value")
enabled: {
get(value) {
if (Ember.isEmpty(value)) {
if (isEmpty(value)) {
return false;
}
return value.toString() === "true";

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { schedule } from "@ember/runloop";
import Component from "@ember/component";
import WatchedWord from "admin/models/watched-word";
@ -23,7 +24,7 @@ export default Component.extend({
@observes("word")
removeMessage() {
if (this.showMessage && !Ember.isEmpty(this.word)) {
if (this.showMessage && !isEmpty(this.word)) {
this.set("showMessage", false);
}
},

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { alias } from "@ember/object/computed";
import Controller from "@ember/controller";
import debounce from "discourse/lib/debounce";
@ -10,7 +11,7 @@ export default Controller.extend({
filterContentNow(category) {
// If we have no content, don't bother filtering anything
if (!!Ember.isEmpty(this.allSiteSettings)) return;
if (!!isEmpty(this.allSiteSettings)) return;
let filter;
if (this.filter) {

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { alias } from "@ember/object/computed";
import EmberObject from "@ember/object";
import Controller from "@ember/controller";
@ -11,7 +12,7 @@ export default Controller.extend({
regularExpressions: null,
filterContentNow() {
if (!!Ember.isEmpty(this.allWatchedWords)) return;
if (!!isEmpty(this.allWatchedWords)) return;
let filter;
if (this.filter) {
@ -44,7 +45,7 @@ export default Controller.extend({
filterContent: debounce(function() {
this.filterContentNow();
this.set("filtered", !Ember.isEmpty(this.filter));
this.set("filtered", !isEmpty(this.filter));
}, 250).observes("filter"),
actions: {

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { alias } from "@ember/object/computed";
import { inject } from "@ember/controller";
import Controller from "@ember/controller";
@ -38,7 +39,7 @@ export default Controller.extend({
@computed("model.secret")
secretValidation(secret) {
if (!Ember.isEmpty(secret)) {
if (!isEmpty(secret)) {
if (secret.indexOf(" ") !== -1) {
return InputValidation.create({
failed: true,
@ -57,7 +58,7 @@ export default Controller.extend({
@computed("model.wildcard_web_hook", "model.web_hook_event_types.[]")
eventTypeValidation(isWildcard, eventTypes) {
if (!isWildcard && Ember.isEmpty(eventTypes)) {
if (!isWildcard && isEmpty(eventTypes)) {
return InputValidation.create({
failed: true,
reason: I18n.t("admin.web_hooks.event_type_missing")
@ -79,7 +80,7 @@ export default Controller.extend({
) {
return isSaving
? false
: secretValidation || eventTypeValidation || Ember.isEmpty(payloadUrl);
: secretValidation || eventTypeValidation || isEmpty(payloadUrl);
},
actions: {

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { and, not } from "@ember/object/computed";
import { inject } from "@ember/controller";
import Controller from "@ember/controller";
@ -107,7 +108,7 @@ export default Controller.extend(ModalFunctionality, {
actions: {
updateName() {
let name = this.name;
if (Ember.isEmpty(name)) {
if (isEmpty(name)) {
name = $("#file-input")[0].files[0].name;
this.set("name", name.split(".")[0]);
}

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import Controller from "@ember/controller";
import computed from "ember-addons/ember-computed-decorators";
import PenaltyController from "admin/mixins/penalty-controller";
@ -14,7 +15,7 @@ export default Controller.extend(PenaltyController, {
@computed("silenceUntil", "reason", "silencing")
submitDisabled(silenceUntil, reason, silencing) {
return (
silencing || Ember.isEmpty(silenceUntil) || !reason || reason.length < 1
silencing || isEmpty(silenceUntil) || !reason || reason.length < 1
);
},

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import Controller from "@ember/controller";
import computed from "ember-addons/ember-computed-decorators";
import PenaltyController from "admin/mixins/penalty-controller";
@ -14,7 +15,7 @@ export default Controller.extend(PenaltyController, {
@computed("suspendUntil", "reason", "suspending")
submitDisabled(suspendUntil, reason, suspending) {
return (
suspending || Ember.isEmpty(suspendUntil) || !reason || reason.length < 1
suspending || isEmpty(suspendUntil) || !reason || reason.length < 1
);
},

View File

@ -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;

View File

@ -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) {

View File

@ -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)) {

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
@ -15,7 +16,7 @@ export default DiscourseRoute.extend({
setupController(controller, model) {
if (
model.get("isNew") ||
Ember.isEmpty(model.get("web_hook_event_types"))
isEmpty(model.get("web_hook_event_types"))
) {
model.set("web_hook_event_types", controller.get("defaultEventTypes"));
}

View File

@ -66,6 +66,9 @@ var define, requirejs;
"@ember/service": {
default: Ember.Service,
inject: Ember.inject.service
},
"@ember/utils": {
isEmpty: Ember.isEmpty
}
};
}

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import Component from "@ember/component";
import computed from "ember-addons/ember-computed-decorators";
@ -11,7 +12,7 @@ export default Component.extend({
@computed("categories.[].uploaded_logo.url")
anyLogos() {
return this.categories.any(c => {
return !Ember.isEmpty(c.get("uploaded_logo.url"));
return !isEmpty(c.get("uploaded_logo.url"));
});
}
});

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import Component from "@ember/component";
import computed from "ember-addons/ember-computed-decorators";
import DiscourseURL from "discourse/lib/url";
@ -12,12 +13,12 @@ export default Component.extend({
@computed("categories.[].uploaded_logo.url")
anyLogos() {
return this.categories.any(c => !Ember.isEmpty(c.get("uploaded_logo.url")));
return this.categories.any(c => !isEmpty(c.get("uploaded_logo.url")));
},
@computed("categories.[].subcategories")
hasSubcategories() {
return this.categories.any(c => !Ember.isEmpty(c.get("subcategories")));
return this.categories.any(c => !isEmpty(c.get("subcategories")));
},
click(e) {

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { next } from "@ember/runloop";
import Component from "@ember/component";
import debounce from "discourse/lib/debounce";
@ -31,7 +32,7 @@ export default Component.extend({
search: debounce(function(title) {
const currentTopicId = this.currentTopicId;
if (Ember.isEmpty(title)) {
if (isEmpty(title)) {
this.setProperties({ messages: null, loading: false });
return;
}

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { next } from "@ember/runloop";
import Component from "@ember/component";
import debounce from "discourse/lib/debounce";
@ -39,7 +40,7 @@ export default Component.extend({
const currentTopicId = this.currentTopicId;
if (Ember.isEmpty(title)) {
if (isEmpty(title)) {
this.setProperties({ topics: null, loading: false });
return;
}

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { not } from "@ember/object/computed";
import { buildCategoryPanel } from "discourse/components/edit-category-panel";
import { categoryBadgeHTML } from "discourse/helpers/category-link";
@ -84,7 +85,7 @@ export default buildCategoryPanel("general", {
// We can change the parent if there are no children
@computed("category.id")
subCategories(categoryId) {
if (Ember.isEmpty(categoryId)) {
if (isEmpty(categoryId)) {
return null;
}
return Category.list().filterBy("parent_category_id", categoryId);

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { alias, equal, or } from "@ember/object/computed";
import { schedule } from "@ember/runloop";
import Component from "@ember/component";
@ -34,7 +35,7 @@ export default Component.extend({
)
saveDisabled(updateTime, loading, publishToCategory, topicTimerCategoryId) {
return (
Ember.isEmpty(updateTime) ||
isEmpty(updateTime) ||
loading ||
(publishToCategory && !topicTimerCategoryId)
);

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { equal, and, empty } from "@ember/object/computed";
import Component from "@ember/component";
import {
@ -108,7 +109,7 @@ export default Component.extend({
if (
statusType === PUBLISH_TO_CATEGORY_STATUS_TYPE &&
Ember.isEmpty(categoryId)
isEmpty(categoryId)
) {
return false;
}

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { lte } from "@ember/object/computed";
import Component from "@ember/component";
import computed from "ember-addons/ember-computed-decorators";
@ -62,7 +63,7 @@ export default Component.extend({
},
addMembers() {
if (Ember.isEmpty(this.get("model.usernames"))) {
if (isEmpty(this.get("model.usernames"))) {
return;
}
this.model.addMembers(this.get("model.usernames")).catch(popupAjaxError);

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import Component from "@ember/component";
import {
on,
@ -27,7 +28,7 @@ export default Component.extend({
allowAny: false,
items: _.isArray(groupNames)
? groupNames
: Ember.isEmpty(groupNames)
: isEmpty(groupNames)
? []
: [groupNames],
single: this.single,

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { not } from "@ember/object/computed";
import Component from "@ember/component";
import {
@ -65,7 +66,7 @@ export default Component.extend({
checkGroupName: debounce(function() {
name = this.nameInput;
if (Ember.isEmpty(name)) return;
if (isEmpty(name)) return;
Group.checkName(name).then(response => {
const validationName = "uniqueNameValidation";

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { next } from "@ember/runloop";
import Component from "@ember/component";
import computed from "ember-addons/ember-computed-decorators";
@ -30,7 +31,7 @@ export default Component.extend(UploadMixin, {
@computed("placeholderUrl")
placeholderStyle(url) {
if (Ember.isEmpty(url)) {
if (isEmpty(url)) {
return "".htmlSafe();
}
return `background-image: url(${url})`.htmlSafe();
@ -38,7 +39,7 @@ export default Component.extend(UploadMixin, {
@computed("imageUrl")
imageCDNURL(url) {
if (Ember.isEmpty(url)) {
if (isEmpty(url)) {
return "".htmlSafe();
}
@ -52,7 +53,7 @@ export default Component.extend(UploadMixin, {
@computed("imageUrl")
imageBaseName(imageUrl) {
if (Ember.isEmpty(imageUrl)) return;
if (isEmpty(imageUrl)) return;
return imageUrl.split("/").slice(-1)[0];
},

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { alias, and, equal } from "@ember/object/computed";
import EmberObject from "@ember/object";
import Component from "@ember/component";
@ -48,7 +49,7 @@ export default Component.extend({
can_invite_to
) {
if (saving) return true;
if (Ember.isEmpty(emailOrUsername)) return true;
if (isEmpty(emailOrUsername)) return true;
const emailTrimmed = emailOrUsername.trim();
@ -65,7 +66,7 @@ export default Component.extend({
// when inviting to private topic via email, group name must be specified
if (
isPrivateTopic &&
Ember.isEmpty(groupNames) &&
isEmpty(groupNames) &&
emailValid(emailTrimmed)
) {
return true;
@ -94,7 +95,7 @@ export default Component.extend({
) {
if (hasCustomMessage) return true;
if (saving) return true;
if (Ember.isEmpty(emailOrUsername)) return true;
if (isEmpty(emailOrUsername)) return true;
const email = emailOrUsername.trim();
@ -109,7 +110,7 @@ export default Component.extend({
}
// when inviting to private topic via email, group name must be specified
if (isPrivateTopic && Ember.isEmpty(groupNames) && emailValid(email)) {
if (isPrivateTopic && isEmpty(groupNames) && emailValid(email)) {
return true;
}
@ -218,7 +219,7 @@ export default Component.extend({
return I18n.t("topic.invite_reply.to_username");
} else {
// when inviting to a topic, display instructions based on provided entity
if (Ember.isEmpty(emailOrUsername)) {
if (isEmpty(emailOrUsername)) {
return I18n.t("topic.invite_reply.to_topic_blank");
} else if (emailValid(emailOrUsername)) {
this.set("inviteIcon", "envelope");

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { alias } from "@ember/object/computed";
import { schedule } from "@ember/runloop";
import Component from "@ember/component";
@ -27,7 +28,7 @@ export default Component.extend({
shareUrl(forcedShareUrl, shareUrl) {
shareUrl = forcedShareUrl || shareUrl;
if (Ember.isEmpty(shareUrl)) {
if (isEmpty(shareUrl)) {
return;
}

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { bind } from "@ember/runloop";
import { scheduleOnce } from "@ember/runloop";
import Component from "@ember/component";
@ -59,7 +60,7 @@ export default Component.extend({
const $currentTargetOffset = $target.offset();
const $this = $(this.element);
if (Ember.isEmpty(url)) {
if (isEmpty(url)) {
return;
}

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import Component from "@ember/component";
import computed from "ember-addons/ember-computed-decorators";
import { bufferedProperty } from "discourse/mixins/buffered-content";
@ -8,7 +9,7 @@ export default Component.extend(bufferedProperty("model"), {
@computed("buffered.isSaving", "buffered.name", "buffered.tag_names")
savingDisabled(isSaving, name, tagNames) {
return isSaving || Ember.isEmpty(name) || Ember.isEmpty(tagNames);
return isSaving || isEmpty(name) || isEmpty(tagNames);
},
actions: {

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { alias, gte, and, gt, not, or } from "@ember/object/computed";
import EmberObject from "@ember/object";
import Component from "@ember/component";
@ -69,7 +70,7 @@ export default Component.extend(CardContentsBase, CanCheckEmails, CleansUp, {
@computed("user.user_fields.@each.value")
publicUserFields() {
const siteUserFields = this.site.get("user_fields");
if (!Ember.isEmpty(siteUserFields)) {
if (!isEmpty(siteUserFields)) {
const userFields = this.get("user.user_fields");
return siteUserFields
.filterBy("show_on_user_card", true)
@ -77,7 +78,7 @@ export default Component.extend(CardContentsBase, CanCheckEmails, CleansUp, {
.map(field => {
Ember.set(field, "dasherized_name", field.get("name").dasherize());
const value = userFields ? userFields[field.get("id")] : null;
return Ember.isEmpty(value)
return isEmpty(value)
? null
: EmberObject.create({ value, field });
})
@ -129,7 +130,7 @@ export default Component.extend(CardContentsBase, CanCheckEmails, CleansUp, {
}
const url = this.get("user.card_background_upload_url");
const bg = Ember.isEmpty(url) ? "" : `url(${Discourse.getURLWithCDN(url)})`;
const bg = isEmpty(url) ? "" : `url(${Discourse.getURLWithCDN(url)})`;
thisElem.style.backgroundImage = bg;
},

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { on, observes } from "ember-addons/ember-computed-decorators";
import TextField from "discourse/components/text-field";
import userSearch from "discourse/lib/user-search";
@ -130,7 +131,7 @@ export default TextField.extend({
// THIS IS A HUGE HACK TO SUPPORT CLEARING THE INPUT
@observes("usernames")
_clearInput() {
if (arguments.length > 1 && Ember.isEmpty(this.usernames)) {
if (arguments.length > 1 && isEmpty(this.usernames)) {
$(this.element)
.parent()
.find("a")

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import Controller from "@ember/controller";
import ModalFunctionality from "discourse/mixins/modal-functionality";
import computed from "ember-addons/ember-computed-decorators";
@ -13,7 +14,7 @@ export default Controller.extend(ModalFunctionality, {
@computed("saving", "notice")
disabled(saving, notice) {
return saving || Ember.isEmpty(notice);
return saving || isEmpty(notice);
},
onShow() {

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { alias } from "@ember/object/computed";
import { next } from "@ember/runloop";
import { inject } from "@ember/controller";
@ -17,7 +18,7 @@ export default Controller.extend(ModalFunctionality, {
@computed("saving", "new_user")
buttonDisabled(saving, newUser) {
return saving || Ember.isEmpty(newUser);
return saving || isEmpty(newUser);
},
@computed("saving")

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { next } from "@ember/runloop";
import { inject } from "@ember/controller";
import Controller from "@ember/controller";
@ -31,7 +32,7 @@ export default Controller.extend(ModalFunctionality, {
@computed("saving", "date", "validTimestamp")
buttonDisabled(saving, date, validTimestamp) {
if (saving || validTimestamp) return true;
return Ember.isEmpty(date);
return isEmpty(date);
},
onShow() {

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { and, or, alias, reads } from "@ember/object/computed";
import { debounce } from "@ember/runloop";
import { inject as service } from "@ember/service";
@ -302,7 +303,7 @@ export default Controller.extend({
// We need exactly one user to issue a warning
if (
Ember.isEmpty(usernames) ||
isEmpty(usernames) ||
usernames.split(",").length !== 1 ||
hasTargetGroups
) {
@ -441,8 +442,8 @@ export default Controller.extend({
this.closeAutocomplete();
if (
Ember.isEmpty(this.get("model.reply")) &&
Ember.isEmpty(this.get("model.title"))
isEmpty(this.get("model.reply")) &&
isEmpty(this.get("model.title"))
) {
this.close();
} else {
@ -744,7 +745,7 @@ export default Controller.extend({
// Notify the composer messages controller that a reply has been typed. Some
// messages only appear after typing.
checkReplyLength() {
if (!Ember.isEmpty("model.reply")) {
if (!isEmpty("model.reply")) {
this.appEvents.trigger("composer:typed-reply");
}
},

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { notEmpty, or, not } from "@ember/object/computed";
import { inject } from "@ember/controller";
import Controller from "@ember/controller";
@ -91,7 +92,7 @@ export default Controller.extend(
@computed("authOptions.auth_provider")
passwordRequired(authProvider) {
return Ember.isEmpty(authProvider);
return isEmpty(authProvider);
},
@computed
@ -108,7 +109,7 @@ export default Controller.extend(
@computed("accountEmail", "rejectedEmails.[]")
emailValidation(email, rejectedEmails) {
// If blank, fail without a reason
if (Ember.isEmpty(email)) {
if (isEmpty(email)) {
return InputValidation.create({
failed: true
});
@ -176,7 +177,7 @@ export default Controller.extend(
}
if (
this.get("emailValidation.ok") &&
(Ember.isEmpty(this.accountUsername) || this.get("authOptions.email"))
(isEmpty(this.accountUsername) || this.get("authOptions.email"))
) {
// If email is valid and username has not been entered yet,
// or email and username were filled automatically by 3rd parth auth,
@ -226,12 +227,12 @@ export default Controller.extend(
const userFields = this.userFields;
const destinationUrl = this.get("authOptions.destination_url");
if (!Ember.isEmpty(destinationUrl)) {
if (!isEmpty(destinationUrl)) {
$.cookie("destination_url", destinationUrl, { path: "/" });
}
// Add the userfields to the data
if (!Ember.isEmpty(userFields)) {
if (!isEmpty(userFields)) {
attrs.userFields = {};
userFields.forEach(
f => (attrs.userFields[f.get("field.id")] = f.get("value"))

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import Controller from "@ember/controller";
import ModalFunctionality from "discourse/mixins/modal-functionality";
import DiscourseURL from "discourse/lib/url";
@ -31,7 +32,7 @@ export default Controller.extend(ModalFunctionality, {
@observes("model.description")
changeSize() {
if (!Ember.isEmpty(this.get("model.description"))) {
if (!isEmpty(this.get("model.description"))) {
this.set("modal.modalClass", "edit-category-modal full");
} else {
this.set("modal.modalClass", "edit-category-modal small");

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import Controller from "@ember/controller";
import { ajax } from "discourse/lib/ajax";
import ModalFunctionality from "discourse/mixins/modal-functionality";
@ -11,7 +12,7 @@ export default Controller.extend(ModalFunctionality, {
@computed("accountEmailOrUsername", "disabled")
submitDisabled(accountEmailOrUsername, disabled) {
return Ember.isEmpty((accountEmailOrUsername || "").trim()) || disabled;
return isEmpty((accountEmailOrUsername || "").trim()) || disabled;
},
onShow() {

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { or } from "@ember/object/computed";
import { inject } from "@ember/controller";
import Controller from "@ember/controller";
@ -54,7 +55,7 @@ export default Controller.extend({
@computed("q")
hasAutofocus(q) {
return Ember.isEmpty(q);
return isEmpty(q);
},
@computed("q")

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import Controller from "@ember/controller";
import computed from "ember-addons/ember-computed-decorators";
import { extractError } from "discourse/lib/ajax-error";
@ -18,7 +19,7 @@ export default Controller.extend(ModalFunctionality, {
const model = this.model;
const usernames = model.get("usernames");
if (Ember.isEmpty(usernames)) {
if (isEmpty(usernames)) {
return;
}
let promise;

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import Controller from "@ember/controller";
import computed from "ember-addons/ember-computed-decorators";
import { extractError } from "discourse/lib/ajax-error";
@ -9,7 +10,7 @@ export default Controller.extend(ModalFunctionality, {
@computed("input", "loading", "result")
disableAddButton(input, loading, result) {
return loading || Ember.isEmpty(input) || input.length <= 0 || result;
return loading || isEmpty(input) || input.length <= 0 || result;
},
actions: {

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { debounce } from "@ember/runloop";
import { cancel } from "@ember/runloop";
import { scheduleOnce } from "@ember/runloop";
@ -148,7 +149,7 @@ export default Controller.extend(ModalFunctionality, {
origLink.indexOf("://") === -1 ? `http://${origLink}` : origLink;
const sel = this._lastSel;
if (Ember.isEmpty(linkUrl)) {
if (isEmpty(linkUrl)) {
return;
}

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { alias, notEmpty } from "@ember/object/computed";
import Controller from "@ember/controller";
import { default as computed } from "ember-addons/ember-computed-decorators";
@ -68,7 +69,7 @@ export default Controller.extend(
submit() {
const userFields = this.userFields;
let userCustomFields = {};
if (!Ember.isEmpty(userFields)) {
if (!isEmpty(userFields)) {
userFields.forEach(function(f) {
userCustomFields[f.get("field.id")] = f.get("value");
});

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { alias, or, readOnly } from "@ember/object/computed";
import EmberObject from "@ember/object";
import { next } from "@ember/runloop";
@ -107,7 +108,7 @@ export default Controller.extend(ModalFunctionality, {
return;
}
if (Ember.isEmpty(this.loginName) || Ember.isEmpty(this.loginPassword)) {
if (isEmpty(this.loginName) || isEmpty(this.loginPassword)) {
this.flash(I18n.t("login.blank_username_or_password"), "error");
return;
}
@ -273,7 +274,7 @@ export default Controller.extend(ModalFunctionality, {
return;
}
if (Ember.isEmpty(this.loginName)) {
if (isEmpty(this.loginName)) {
this.flash(I18n.t("login.blank_username"), "error");
return;
}

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { alias, equal } from "@ember/object/computed";
import { next } from "@ember/runloop";
import { inject } from "@ember/controller";
@ -48,7 +49,7 @@ export default Controller.extend(ModalFunctionality, {
@computed("saving", "selectedTopicId", "topicName")
buttonDisabled(saving, selectedTopicId, topicName) {
return (
saving || (Ember.isEmpty(selectedTopicId) && Ember.isEmpty(topicName))
saving || (isEmpty(selectedTopicId) && isEmpty(topicName))
);
},

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { not, or, gt } from "@ember/object/computed";
import Controller from "@ember/controller";
import { iconHTML } from "discourse-common/lib/icon-library";
@ -241,7 +242,7 @@ export default Controller.extend(CanCheckEmails, PreferencesTabController, {
.then(() => {
if (!token) {
const redirect = this.siteSettings.logout_redirect;
if (Ember.isEmpty(redirect)) {
if (isEmpty(redirect)) {
window.location = Discourse.getURL("/");
} else {
window.location.href = redirect;

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import EmberObject from "@ember/object";
import Controller from "@ember/controller";
import { default as computed } from "ember-addons/ember-computed-decorators";
@ -24,7 +25,7 @@ export default Controller.extend(PreferencesTabController, {
@computed("model.user_fields.@each.value")
userFields() {
let siteUserFields = this.site.get("user_fields");
if (!Ember.isEmpty(siteUserFields)) {
if (!isEmpty(siteUserFields)) {
const userFields = this.get("model.user_fields");
// Staff can edit fields that are not `editable`
@ -53,9 +54,9 @@ export default Controller.extend(PreferencesTabController, {
userFields = this.userFields;
// Update the user fields
if (!Ember.isEmpty(userFields)) {
if (!isEmpty(userFields)) {
const modelFields = model.get("user_fields");
if (!Ember.isEmpty(modelFields)) {
if (!isEmpty(modelFields)) {
userFields.forEach(function(uf) {
modelFields[uf.get("field.id").toString()] = uf.get("value");
});

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { empty, or } from "@ember/object/computed";
import Controller from "@ember/controller";
import {
@ -37,7 +38,7 @@ export default Controller.extend({
this.set("taken", false);
this.set("errorMessage", null);
if (Ember.isEmpty(this.newUsername)) return;
if (isEmpty(this.newUsername)) return;
if (this.unchanged) return;
Discourse.User.checkUsername(

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { alias } from "@ember/object/computed";
import Controller from "@ember/controller";
import computed from "ember-addons/ember-computed-decorators";
@ -16,7 +17,7 @@ export default Controller.extend(ModalFunctionality, {
@computed("loading", "reason")
disableSubmit(loading, reason) {
return loading || Ember.isEmpty(reason);
return loading || isEmpty(reason);
},
actions: {

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { or, and, not, alias } from "@ember/object/computed";
import EmberObject from "@ember/object";
import { next } from "@ember/runloop";
@ -72,7 +73,7 @@ export default Controller.extend(bufferedProperty("model"), {
@observes("model.title", "category")
_titleChanged() {
const title = this.get("model.title");
if (!Ember.isEmpty(title)) {
if (!isEmpty(title)) {
// force update lazily loaded titles
this.send("refreshTitle");
}
@ -985,7 +986,7 @@ export default Controller.extend(bufferedProperty("model"), {
composerController
.open(options)
.then(() => {
return Ember.isEmpty(quotedText) ? "" : quotedText;
return isEmpty(quotedText) ? "" : quotedText;
})
.then(q => {
const postUrl = `${location.protocol}//${location.host}${post.get(

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { alias, or, gt, not, and } from "@ember/object/computed";
import EmberObject from "@ember/object";
import { inject as service } from "@ember/service";
@ -29,7 +30,7 @@ export default Controller.extend(CanCheckEmails, {
@computed("model.profileBackgroundUrl")
hasProfileBackgroundUrl(background) {
return !Ember.isEmpty(background.toString());
return !isEmpty(background.toString());
},
@computed("model.profile_hidden", "indexStream", "viewingSelf", "forceExpand")
@ -108,7 +109,7 @@ export default Controller.extend(CanCheckEmails, {
@computed("model.user_fields.@each.value")
publicUserFields() {
const siteUserFields = this.site.get("user_fields");
if (!Ember.isEmpty(siteUserFields)) {
if (!isEmpty(siteUserFields)) {
const userFields = this.get("model.user_fields");
return siteUserFields
.filterBy("show_on_profile", true)
@ -118,7 +119,7 @@ export default Controller.extend(CanCheckEmails, {
const value = userFields
? userFields[field.get("id").toString()]
: null;
return Ember.isEmpty(value)
return isEmpty(value)
? null
: EmberObject.create({ value, field });
})

View File

@ -1,8 +1,9 @@
import { isEmpty } from "@ember/utils";
import { htmlHelper } from "discourse-common/lib/helpers";
import { avatarImg } from "discourse/lib/utilities";
export default htmlHelper((avatarTemplate, size) => {
if (Ember.isEmpty(avatarTemplate)) {
if (isEmpty(avatarTemplate)) {
return "<div class='avatar-placeholder'></div>";
} else {
return avatarImg({ size, avatarTemplate });

View File

@ -1,9 +1,10 @@
import { isEmpty } from "@ember/utils";
import { htmlHelper } from "discourse-common/lib/helpers";
import { avatarImg } from "discourse/lib/utilities";
import { addExtraUserClasses } from "discourse/helpers/user-avatar";
export default htmlHelper((user, size) => {
if (Ember.isEmpty(user)) {
if (isEmpty(user)) {
return "<div class='avatar-placeholder'></div>";
}

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { htmlHelper } from "discourse-common/lib/helpers";
export default htmlHelper(str => (Ember.isEmpty(str) ? "&mdash;" : str));
export default htmlHelper(str => (isEmpty(str) ? "&mdash;" : str));

View File

@ -1,12 +1,13 @@
import { isEmpty } from "@ember/utils";
import { htmlHelper } from "discourse-common/lib/helpers";
import { iconHTML, convertIconClass } from "discourse-common/lib/icon-library";
export default htmlHelper(function({ icon, image }) {
if (!Ember.isEmpty(image)) {
if (!isEmpty(image)) {
return `<img src='${image}'>`;
}
if (Ember.isEmpty(icon)) {
if (isEmpty(icon)) {
return "";
}

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
export default function logout(siteSettings, keyValueStore) {
if (!siteSettings || !keyValueStore) {
const container = Discourse.__container__;
@ -8,7 +9,7 @@ export default function logout(siteSettings, keyValueStore) {
keyValueStore.abandonLocal();
const redirect = siteSettings.logout_redirect;
if (Ember.isEmpty(redirect)) {
if (isEmpty(redirect)) {
window.location = Discourse.getURL("/");
} else {
window.location.href = redirect;

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import EmberObject from "@ember/object";
import { ajax } from "discourse/lib/ajax";
import { findRawTemplate } from "discourse/lib/raw-templates";
@ -53,7 +54,7 @@ export function translateResults(results, opts) {
const fullName = Handlebars.Utils.escapeExpression(
group.full_name || group.display_name
);
const flairUrl = Ember.isEmpty(group.flair_url)
const flairUrl = isEmpty(group.flair_url)
? null
: Handlebars.Utils.escapeExpression(group.flair_url);
const flairColor = Handlebars.Utils.escapeExpression(group.flair_color);

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { userPath } from "discourse/lib/url";
const _additionalAttributes = [];
@ -48,7 +49,7 @@ export function transformBasicPost(post) {
showFlagDelete: false,
canRecover: post.can_recover,
canEdit: post.can_edit,
canFlag: !Ember.isEmpty(post.get("flagsAvailable")),
canFlag: !isEmpty(post.get("flagsAvailable")),
canReviewTopic: false,
reviewableId: post.reviewable_id,
reviewableScoreCount: post.reviewable_score_count,

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import EmberObject from "@ember/object";
import { next } from "@ember/runloop";
import { schedule } from "@ember/runloop";
@ -62,7 +63,7 @@ export function groupPath(subPath) {
let _jumpScheduled = false;
export function jumpToElement(elementId) {
if (_jumpScheduled || Ember.isEmpty(elementId)) {
if (_jumpScheduled || isEmpty(elementId)) {
return;
}
@ -191,7 +192,7 @@ const DiscourseURL = EmberObject.extend({
routeTo(path, opts) {
opts = opts || {};
if (Ember.isEmpty(path)) {
if (isEmpty(path)) {
return;
}

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import InputValidation from "discourse/models/input-validation";
import { default as computed } from "ember-addons/ember-computed-decorators";
import Mixin from "@ember/object/mixin";
@ -17,7 +18,7 @@ export default Mixin.create({
nameValidation() {
if (
this.siteSettings.full_name_required &&
Ember.isEmpty(this.accountName)
isEmpty(this.accountName)
) {
return InputValidation.create({ failed: true });
}

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import InputValidation from "discourse/models/input-validation";
import { default as computed } from "ember-addons/ember-computed-decorators";
import Mixin from "@ember/object/mixin";
@ -55,7 +56,7 @@ export default Mixin.create({
}
// If blank, fail without a reason
if (Ember.isEmpty(password)) {
if (isEmpty(password)) {
return InputValidation.create({ failed: true });
}
@ -67,14 +68,14 @@ export default Mixin.create({
});
}
if (!Ember.isEmpty(accountUsername) && password === accountUsername) {
if (!isEmpty(accountUsername) && password === accountUsername) {
return InputValidation.create({
failed: true,
reason: I18n.t("user.password.same_as_username")
});
}
if (!Ember.isEmpty(accountEmail) && password === accountEmail) {
if (!isEmpty(accountEmail) && password === accountEmail) {
return InputValidation.create({
failed: true,
reason: I18n.t("user.password.same_as_email")

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import EmberObject from "@ember/object";
import InputValidation from "discourse/models/input-validation";
import {
@ -29,10 +30,10 @@ export default Mixin.create({
if (userFields) {
userFields = userFields.filterBy("field.required");
}
if (!Ember.isEmpty(userFields)) {
if (!isEmpty(userFields)) {
const anyEmpty = userFields.any(uf => {
const val = uf.get("value");
return !val || Ember.isEmpty(val);
return !val || isEmpty(val);
});
if (anyEmpty) {
return InputValidation.create({ failed: true });

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import InputValidation from "discourse/models/input-validation";
import debounce from "discourse/lib/debounce";
import { setting } from "discourse/lib/computed";
@ -15,7 +16,7 @@ export default Mixin.create({
Discourse.User.checkUsername(null, this.accountEmail).then(result => {
if (
result.suggestion &&
(Ember.isEmpty(this.accountUsername) ||
(isEmpty(this.accountUsername) ||
this.accountUsername === this.get("authOptions.username"))
) {
this.setProperties({
@ -38,7 +39,7 @@ export default Mixin.create({
}
// If blank, fail without a reason
if (Ember.isEmpty(accountUsername)) {
if (isEmpty(accountUsername)) {
return InputValidation.create({ failed: true });
}
@ -68,7 +69,7 @@ export default Mixin.create({
shouldCheckUsernameAvailability() {
return (
!Ember.isEmpty(this.accountUsername) &&
!isEmpty(this.accountUsername) &&
this.accountUsername.length >= this.minUsernameLength
);
},

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { reads, equal, not, or, and } from "@ember/object/computed";
import EmberObject from "@ember/object";
import { next } from "@ember/runloop";
@ -116,7 +117,7 @@ const Composer = RestModel.extend({
set(categoryId) {
const oldCategoryId = this._categoryId;
if (Ember.isEmpty(categoryId)) {
if (isEmpty(categoryId)) {
categoryId = null;
}
this._categoryId = categoryId;
@ -420,7 +421,7 @@ const Composer = RestModel.extend({
@computed("metaData")
hasMetaData(metaData) {
return metaData ? Ember.isEmpty(Ember.keys(metaData)) : false;
return metaData ? isEmpty(Ember.keys(metaData)) : false;
},
replyDirty: propertyNotEqual("reply", "originalText"),
@ -610,7 +611,7 @@ const Composer = RestModel.extend({
}
}
if (!Ember.isEmpty(reply)) {
if (!isEmpty(reply)) {
return;
}
@ -633,7 +634,7 @@ const Composer = RestModel.extend({
if (!opts) opts = {};
this.set("loading", false);
const replyBlank = Ember.isEmpty(this.reply);
const replyBlank = isEmpty(this.reply);
const composer = this;
if (
@ -1055,7 +1056,7 @@ const Composer = RestModel.extend({
let data = this.serialize(_draft_serializer);
if (data.postId && !Ember.isEmpty(this.originalText)) {
if (data.postId && !isEmpty(this.originalText)) {
data.originalText = this.originalText;
}

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { notEmpty, equal } from "@ember/object/computed";
import { ajax } from "discourse/lib/ajax";
import {
@ -27,7 +28,7 @@ const Group = RestModel.extend({
@computed("automatic_membership_email_domains")
emailDomains(value) {
return Ember.isEmpty(value) ? "" : value;
return isEmpty(value) ? "" : value;
},
@computed("automatic")
@ -44,7 +45,7 @@ const Group = RestModel.extend({
},
findMembers(params) {
if (Ember.isEmpty(this.name) || !this.can_see_members) {
if (isEmpty(this.name) || !this.can_see_members) {
return;
}

View File

@ -1,10 +1,11 @@
import { isEmpty } from "@ember/utils";
import EmberObject from "@ember/object";
const Model = EmberObject.extend();
Model.reopenClass({
extractByKey(collection, klass) {
const retval = {};
if (Ember.isEmpty(collection)) {
if (isEmpty(collection)) {
return retval;
}

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { or, not, and } from "@ember/object/computed";
import { ajax } from "discourse/lib/ajax";
import DiscourseURL from "discourse/lib/url";
@ -114,7 +115,7 @@ export default RestModel.extend({
}
const userFilters = this.userFilters;
if (!Ember.isEmpty(userFilters)) {
if (!isEmpty(userFilters)) {
result.username_filters = userFilters.join(",");
}
@ -361,7 +362,7 @@ export default RestModel.extend({
});
} else {
const postIds = this.nextWindow;
if (Ember.isEmpty(postIds)) return Ember.RSVP.resolve();
if (isEmpty(postIds)) return Ember.RSVP.resolve();
this.set("loadingBelow", true);
postsWithPlaceholders.appending(postIds);
@ -402,7 +403,7 @@ export default RestModel.extend({
});
} else {
const postIds = this.previousWindow;
if (Ember.isEmpty(postIds)) return Ember.RSVP.resolve();
if (isEmpty(postIds)) return Ember.RSVP.resolve();
this.set("loadingAbove", true);
return this.findPostsByIds(postIds.reverse())
@ -520,7 +521,7 @@ export default RestModel.extend({
},
removePosts(posts) {
if (Ember.isEmpty(posts)) {
if (isEmpty(posts)) {
return;
}
@ -955,7 +956,7 @@ export default RestModel.extend({
},
loadIntoIdentityMap(postIds) {
if (Ember.isEmpty(postIds)) {
if (isEmpty(postIds)) {
return Ember.RSVP.resolve([]);
}

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { equal, and, or, not } from "@ember/object/computed";
import EmberObject from "@ember/object";
import { ajax } from "discourse/lib/ajax";
@ -93,7 +94,7 @@ const Post = RestModel.extend({
@computed("link_counts.@each.internal")
internalLinks() {
if (Ember.isEmpty(this.link_counts)) return null;
if (isEmpty(this.link_counts)) return null;
return this.link_counts.filterBy("internal").filterBy("title");
},

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { alias, sort } from "@ember/object/computed";
import EmberObject from "@ember/object";
import computed from "ember-addons/ember-computed-decorators";
@ -39,7 +40,7 @@ const Site = RestModel.extend({
let siteFields = this.user_fields;
if (!Ember.isEmpty(siteFields)) {
if (!isEmpty(siteFields)) {
return siteFields.map(f => {
let value = fields ? fields[f.id.toString()] : null;
value = value || "&mdash;".htmlSafe();

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { NotificationLevels } from "discourse/lib/notification-levels";
import {
default as computed,
@ -215,7 +216,7 @@ const TopicTrackingState = Discourse.Model.extend({
// If we have a cached topic list, we can update it from our tracking information.
updateTopics(topics) {
if (Ember.isEmpty(topics)) {
if (isEmpty(topics)) {
return;
}

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { gt, equal, or } from "@ember/object/computed";
import EmberObject from "@ember/object";
import { ajax } from "discourse/lib/ajax";
@ -86,7 +87,7 @@ const User = RestModel.extend({
@computed("username", "name")
displayName(username, name) {
if (Discourse.SiteSettings.enable_names && !Ember.isEmpty(name)) {
if (Discourse.SiteSettings.enable_names && !isEmpty(name)) {
return name;
}
return username;
@ -95,7 +96,7 @@ const User = RestModel.extend({
@computed("profile_background_upload_url")
profileBackgroundUrl(bgUrl) {
if (
Ember.isEmpty(bgUrl) ||
isEmpty(bgUrl) ||
!Discourse.SiteSettings.allow_profile_backgrounds
) {
return "".htmlSafe();
@ -515,7 +516,7 @@ const User = RestModel.extend({
// The user's stat count, excluding PMs.
@computed("statsExcludingPms.@each.count")
statsCountNonPM() {
if (Ember.isEmpty(this.statsExcludingPms)) return 0;
if (isEmpty(this.statsExcludingPms)) return 0;
let count = 0;
this.statsExcludingPms.forEach(val => {
if (this.inAllStream(val)) {
@ -528,7 +529,7 @@ const User = RestModel.extend({
// The user's stats, excluding PMs.
@computed("stats.@each.isPM")
statsExcludingPms() {
if (Ember.isEmpty(this.stats)) return [];
if (isEmpty(this.stats)) return [];
return this.stats.rejectBy("isPM");
},
@ -538,7 +539,7 @@ const User = RestModel.extend({
return PreloadStore.getAndRemove(`user_${user.get("username")}`, () => {
return ajax(userPath(`${user.get("username")}.json`), { data: options });
}).then(json => {
if (!Ember.isEmpty(json.user.stats)) {
if (!isEmpty(json.user.stats)) {
json.user.stats = Discourse.User.groupStats(
json.user.stats.map(s => {
if (s.count) s.count = parseInt(s.count, 10);
@ -547,7 +548,7 @@ const User = RestModel.extend({
);
}
if (!Ember.isEmpty(json.user.groups)) {
if (!isEmpty(json.user.groups)) {
const groups = [];
for (let i = 0; i < json.user.groups.length; i++) {
@ -563,7 +564,7 @@ const User = RestModel.extend({
json.user.invited_by = Discourse.User.create(json.user.invited_by);
}
if (!Ember.isEmpty(json.user.featured_user_badge_ids)) {
if (!isEmpty(json.user.featured_user_badge_ids)) {
const userBadgesMap = {};
UserBadge.createFromJson(json).forEach(userBadge => {
userBadgesMap[userBadge.get("id")] = userBadge;

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { scheduleOnce } from "@ember/runloop";
import DiscourseRoute from "discourse/routes/discourse";
import DiscourseURL from "discourse/lib/url";
@ -68,7 +69,7 @@ export default DiscourseRoute.extend({
}
DiscourseURL.jumpToPost(closest, opts);
if (!Ember.isEmpty(topic.draft)) {
if (!isEmpty(topic.draft)) {
composerController.open({
draft: Draft.getLocal(topic.draft_key, topic.draft),
draftKey: topic.draft_key,

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { cancel } from "@ember/runloop";
import { scheduleOnce } from "@ember/runloop";
import { later } from "@ember/runloop";
@ -220,7 +221,7 @@ const TopicRoute = DiscourseRoute.extend({
userFilters = postStream.get("userFilters");
userFilters.clear();
if (!Ember.isEmpty(usernames) && usernames !== "undefined") {
if (!isEmpty(usernames) && usernames !== "undefined") {
userFilters.addObjects(usernames.split(","));
}

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import EmberObject from "@ember/object";
import {
default as computed,
@ -48,7 +49,7 @@ const LogsNotice = EmberObject.extend({
@computed("text")
isEmpty(text) {
return Ember.isEmpty(text);
return isEmpty(text);
},
@computed("text")
@ -62,8 +63,8 @@ const LogsNotice = EmberObject.extend({
},
@computed("isEmpty", "isAdmin")
hidden(isEmpty, isAdmin) {
return !isAdmin || isEmpty;
hidden(thisIsEmpty, isAdmin) {
return !isAdmin || thisIsEmpty;
},
@observes("text")

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { wantsNewWindow } from "discourse/lib/intercept-click";
import RawHtml from "discourse/widgets/raw-html";
import { createWidget } from "discourse/widgets/widget";
@ -74,7 +75,7 @@ export const DefaultNotificationItem = createWidget(
const description = data.topic_title;
return Ember.isEmpty(description) ? "" : escapeExpression(description);
return isEmpty(description) ? "" : escapeExpression(description);
},
text(notificationName, data) {

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { createWidgetFrom } from "discourse/widgets/widget";
import { DefaultNotificationItem } from "discourse/widgets/default-notification-item";
import { escapeExpression } from "discourse/lib/utilities";
@ -25,7 +26,7 @@ createWidgetFrom(
}
);
return Ember.isEmpty(description) ? "" : escapeExpression(description);
return isEmpty(description) ? "" : escapeExpression(description);
}
}
);

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import ComboBoxSelectBoxHeaderComponent from "select-kit/components/combo-box/combo-box-header";
import computed from "ember-addons/ember-computed-decorators";
import Category from "discourse/models/category";
@ -12,7 +13,7 @@ export default ComboBoxSelectBoxHeaderComponent.extend({
@computed("computedContent.value", "computedContent.name")
category(value, name) {
if (Ember.isEmpty(value)) {
if (isEmpty(value)) {
const uncat = Category.findUncategorized();
if (uncat && uncat.get("name") === name) {
return uncat;

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import SelectKitRowComponent from "select-kit/components/select-kit/select-kit-row";
import computed from "ember-addons/ember-computed-decorators";
import Category from "discourse/models/category";
@ -27,7 +28,7 @@ export default SelectKitRowComponent.extend({
@computed("computedContent.value", "computedContent.name")
category(value, name) {
if (Ember.isEmpty(value)) {
if (isEmpty(value)) {
const uncat = Category.findUncategorized();
if (uncat && uncat.get("name") === name) {
return uncat;

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import ComboBoxComponent from "select-kit/components/combo-box";
import { CLOSE_STATUS_TYPE } from "discourse/controllers/edit-topic-timer";
import DatetimeMixin from "select-kit/components/future-date-input-selector/mixin";
@ -239,7 +240,7 @@ export default ComboBoxComponent.extend(DatetimeMixin, {
let input = null;
const { time } = this._updateAt(value);
if (time && !Ember.isEmpty(value)) {
if (time && !isEmpty(value)) {
input = time.locale("en").format(FORMAT);
}

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { throttle } from "@ember/runloop";
import { schedule } from "@ember/runloop";
import { on } from "ember-addons/ember-computed-decorators";
@ -114,14 +115,14 @@ export default Mixin.create({
this.unfocus(event);
}
if (keyCode === this.keys.TAB && !event.shiftKey) this.tabFromHeader(event);
if (Ember.isEmpty(this.filter) && keyCode === this.keys.BACKSPACE)
if (isEmpty(this.filter) && keyCode === this.keys.BACKSPACE)
this.backspaceFromHeader(event);
if (keyCode === this.keys.ESC) this.escapeFromHeader(event);
if (keyCode === this.keys.ENTER) this.enterFromHeader(event);
if ([this.keys.UP, this.keys.DOWN].includes(keyCode))
this.upAndDownFromHeader(event);
if (
Ember.isEmpty(this.filter) &&
isEmpty(this.filter) &&
[this.keys.LEFT, this.keys.RIGHT].includes(keyCode)
) {
this.leftAndRightFromHeader(event);
@ -154,7 +155,7 @@ export default Mixin.create({
const keyCode = event.keyCode || event.which;
if (
Ember.isEmpty(this.filter) &&
isEmpty(this.filter) &&
keyCode === this.keys.BACKSPACE &&
typeof this.didPressBackspaceFromFilter === "function"
) {
@ -171,7 +172,7 @@ export default Mixin.create({
this.upAndDownFromFilter(event);
if (
Ember.isEmpty(this.filter) &&
isEmpty(this.filter) &&
[this.keys.LEFT, this.keys.RIGHT].includes(keyCode)
) {
this.leftAndRightFromFilter(event);
@ -197,7 +198,7 @@ export default Mixin.create({
return true;
}
if (Ember.isEmpty(this.filter)) {
if (isEmpty(this.filter)) {
this.close(event);
return true;
}
@ -285,7 +286,7 @@ export default Mixin.create({
if (!this.selection || !this.selection.length) return;
if (!Ember.isEmpty(this.filter)) {
if (!isEmpty(this.filter)) {
this.clearHighlightSelection();
return;
}
@ -336,7 +337,7 @@ export default Mixin.create({
return;
}
if (Ember.isEmpty(this.selection)) return;
if (isEmpty(this.selection)) return;
const keyCode = event.keyCode || event.which;

View File

@ -442,6 +442,7 @@ module ApplicationHelper
ids = theme_ids
end
Rails.logger.info "0 >>>>>> #{name}"
Stylesheet::Manager.stylesheet_link_tag(name, 'all', ids)
end

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { schedule } from "@ember/runloop";
import Component from "@ember/component";
/* global Pikaday:true */
@ -358,7 +359,7 @@ export default Component.extend({
},
_setTimeIfValid(time, key) {
if (Ember.isEmpty(time)) {
if (isEmpty(time)) {
this.set(key, null);
return;
}

View File

@ -1,3 +1,4 @@
import { isEmpty } from "@ember/utils";
import { run } from "@ember/runloop";
import { later } from "@ember/runloop";
/* global QUnit, resetSite */
@ -182,7 +183,7 @@ QUnit.assert.not = function(actual, message) {
QUnit.assert.blank = function(actual, message) {
this.pushResult({
result: Ember.isEmpty(actual),
result: isEmpty(actual),
actual,
message
});
@ -190,7 +191,7 @@ QUnit.assert.blank = function(actual, message) {
QUnit.assert.present = function(actual, message) {
this.pushResult({
result: !Ember.isEmpty(actual),
result: !isEmpty(actual),
actual,
message
});