REFACTOR: Use a module for `Ember.isEmpty`
This commit is contained in:
parent
2b8a013e32
commit
90f934a660
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { empty } from "@ember/object/computed";
|
import { empty } from "@ember/object/computed";
|
||||||
import { scheduleOnce } from "@ember/runloop";
|
import { scheduleOnce } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
|
@ -96,7 +97,7 @@ export default Component.extend(bufferedProperty("userField"), {
|
||||||
|
|
||||||
cancel() {
|
cancel() {
|
||||||
const id = this.get("userField.id");
|
const id = this.get("userField.id");
|
||||||
if (Ember.isEmpty(id)) {
|
if (isEmpty(id)) {
|
||||||
this.destroyAction(this.userField);
|
this.destroyAction(this.userField);
|
||||||
} else {
|
} else {
|
||||||
this.rollbackBuffer();
|
this.rollbackBuffer();
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { or } from "@ember/object/computed";
|
import { or } from "@ember/object/computed";
|
||||||
import { schedule } from "@ember/runloop";
|
import { schedule } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
|
@ -23,7 +24,7 @@ export default Component.extend(bufferedProperty("host"), {
|
||||||
|
|
||||||
@computed("buffered.host", "host.isSaving")
|
@computed("buffered.host", "host.isSaving")
|
||||||
cantSave(host, isSaving) {
|
cantSave(host, isSaving) {
|
||||||
return isSaving || Ember.isEmpty(host);
|
return isSaving || isEmpty(host);
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { on } from "ember-addons/ember-computed-decorators";
|
import { on } from "ember-addons/ember-computed-decorators";
|
||||||
|
|
||||||
|
@ -43,7 +44,7 @@ export default Component.extend({
|
||||||
_checkInvalidInput(inputs) {
|
_checkInvalidInput(inputs) {
|
||||||
this.set("validationMessage", null);
|
this.set("validationMessage", null);
|
||||||
for (let input of inputs) {
|
for (let input of inputs) {
|
||||||
if (Ember.isEmpty(input) || input.includes("|")) {
|
if (isEmpty(input) || input.includes("|")) {
|
||||||
this.set(
|
this.set(
|
||||||
"validationMessage",
|
"validationMessage",
|
||||||
I18n.t("admin.site_settings.secret_list.invalid_input")
|
I18n.t("admin.site_settings.secret_list.invalid_input")
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import computed from "ember-addons/ember-computed-decorators";
|
import computed from "ember-addons/ember-computed-decorators";
|
||||||
|
|
||||||
|
@ -5,7 +6,7 @@ export default Component.extend({
|
||||||
@computed("value")
|
@computed("value")
|
||||||
enabled: {
|
enabled: {
|
||||||
get(value) {
|
get(value) {
|
||||||
if (Ember.isEmpty(value)) {
|
if (isEmpty(value)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return value.toString() === "true";
|
return value.toString() === "true";
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { schedule } from "@ember/runloop";
|
import { schedule } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import WatchedWord from "admin/models/watched-word";
|
import WatchedWord from "admin/models/watched-word";
|
||||||
|
@ -23,7 +24,7 @@ export default Component.extend({
|
||||||
|
|
||||||
@observes("word")
|
@observes("word")
|
||||||
removeMessage() {
|
removeMessage() {
|
||||||
if (this.showMessage && !Ember.isEmpty(this.word)) {
|
if (this.showMessage && !isEmpty(this.word)) {
|
||||||
this.set("showMessage", false);
|
this.set("showMessage", false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { alias } from "@ember/object/computed";
|
import { alias } from "@ember/object/computed";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import debounce from "discourse/lib/debounce";
|
import debounce from "discourse/lib/debounce";
|
||||||
|
@ -10,7 +11,7 @@ export default Controller.extend({
|
||||||
|
|
||||||
filterContentNow(category) {
|
filterContentNow(category) {
|
||||||
// If we have no content, don't bother filtering anything
|
// If we have no content, don't bother filtering anything
|
||||||
if (!!Ember.isEmpty(this.allSiteSettings)) return;
|
if (!!isEmpty(this.allSiteSettings)) return;
|
||||||
|
|
||||||
let filter;
|
let filter;
|
||||||
if (this.filter) {
|
if (this.filter) {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { alias } from "@ember/object/computed";
|
import { alias } from "@ember/object/computed";
|
||||||
import EmberObject from "@ember/object";
|
import EmberObject from "@ember/object";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
|
@ -11,7 +12,7 @@ export default Controller.extend({
|
||||||
regularExpressions: null,
|
regularExpressions: null,
|
||||||
|
|
||||||
filterContentNow() {
|
filterContentNow() {
|
||||||
if (!!Ember.isEmpty(this.allWatchedWords)) return;
|
if (!!isEmpty(this.allWatchedWords)) return;
|
||||||
|
|
||||||
let filter;
|
let filter;
|
||||||
if (this.filter) {
|
if (this.filter) {
|
||||||
|
@ -44,7 +45,7 @@ export default Controller.extend({
|
||||||
|
|
||||||
filterContent: debounce(function() {
|
filterContent: debounce(function() {
|
||||||
this.filterContentNow();
|
this.filterContentNow();
|
||||||
this.set("filtered", !Ember.isEmpty(this.filter));
|
this.set("filtered", !isEmpty(this.filter));
|
||||||
}, 250).observes("filter"),
|
}, 250).observes("filter"),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { alias } from "@ember/object/computed";
|
import { alias } from "@ember/object/computed";
|
||||||
import { inject } from "@ember/controller";
|
import { inject } from "@ember/controller";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
|
@ -38,7 +39,7 @@ export default Controller.extend({
|
||||||
|
|
||||||
@computed("model.secret")
|
@computed("model.secret")
|
||||||
secretValidation(secret) {
|
secretValidation(secret) {
|
||||||
if (!Ember.isEmpty(secret)) {
|
if (!isEmpty(secret)) {
|
||||||
if (secret.indexOf(" ") !== -1) {
|
if (secret.indexOf(" ") !== -1) {
|
||||||
return InputValidation.create({
|
return InputValidation.create({
|
||||||
failed: true,
|
failed: true,
|
||||||
|
@ -57,7 +58,7 @@ export default Controller.extend({
|
||||||
|
|
||||||
@computed("model.wildcard_web_hook", "model.web_hook_event_types.[]")
|
@computed("model.wildcard_web_hook", "model.web_hook_event_types.[]")
|
||||||
eventTypeValidation(isWildcard, eventTypes) {
|
eventTypeValidation(isWildcard, eventTypes) {
|
||||||
if (!isWildcard && Ember.isEmpty(eventTypes)) {
|
if (!isWildcard && isEmpty(eventTypes)) {
|
||||||
return InputValidation.create({
|
return InputValidation.create({
|
||||||
failed: true,
|
failed: true,
|
||||||
reason: I18n.t("admin.web_hooks.event_type_missing")
|
reason: I18n.t("admin.web_hooks.event_type_missing")
|
||||||
|
@ -79,7 +80,7 @@ export default Controller.extend({
|
||||||
) {
|
) {
|
||||||
return isSaving
|
return isSaving
|
||||||
? false
|
? false
|
||||||
: secretValidation || eventTypeValidation || Ember.isEmpty(payloadUrl);
|
: secretValidation || eventTypeValidation || isEmpty(payloadUrl);
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { and, not } from "@ember/object/computed";
|
import { and, not } from "@ember/object/computed";
|
||||||
import { inject } from "@ember/controller";
|
import { inject } from "@ember/controller";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
|
@ -107,7 +108,7 @@ export default Controller.extend(ModalFunctionality, {
|
||||||
actions: {
|
actions: {
|
||||||
updateName() {
|
updateName() {
|
||||||
let name = this.name;
|
let name = this.name;
|
||||||
if (Ember.isEmpty(name)) {
|
if (isEmpty(name)) {
|
||||||
name = $("#file-input")[0].files[0].name;
|
name = $("#file-input")[0].files[0].name;
|
||||||
this.set("name", name.split(".")[0]);
|
this.set("name", name.split(".")[0]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import computed from "ember-addons/ember-computed-decorators";
|
import computed from "ember-addons/ember-computed-decorators";
|
||||||
import PenaltyController from "admin/mixins/penalty-controller";
|
import PenaltyController from "admin/mixins/penalty-controller";
|
||||||
|
@ -14,7 +15,7 @@ export default Controller.extend(PenaltyController, {
|
||||||
@computed("silenceUntil", "reason", "silencing")
|
@computed("silenceUntil", "reason", "silencing")
|
||||||
submitDisabled(silenceUntil, reason, silencing) {
|
submitDisabled(silenceUntil, reason, silencing) {
|
||||||
return (
|
return (
|
||||||
silencing || Ember.isEmpty(silenceUntil) || !reason || reason.length < 1
|
silencing || isEmpty(silenceUntil) || !reason || reason.length < 1
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import computed from "ember-addons/ember-computed-decorators";
|
import computed from "ember-addons/ember-computed-decorators";
|
||||||
import PenaltyController from "admin/mixins/penalty-controller";
|
import PenaltyController from "admin/mixins/penalty-controller";
|
||||||
|
@ -14,7 +15,7 @@ export default Controller.extend(PenaltyController, {
|
||||||
@computed("suspendUntil", "reason", "suspending")
|
@computed("suspendUntil", "reason", "suspending")
|
||||||
submitDisabled(suspendUntil, reason, suspending) {
|
submitDisabled(suspendUntil, reason, suspending) {
|
||||||
return (
|
return (
|
||||||
suspending || Ember.isEmpty(suspendUntil) || !reason || reason.length < 1
|
suspending || isEmpty(suspendUntil) || !reason || reason.length < 1
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import EmberObject from "@ember/object";
|
import EmberObject from "@ember/object";
|
||||||
import { escapeExpression } from "discourse/lib/utilities";
|
import { escapeExpression } from "discourse/lib/utilities";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
|
@ -392,7 +393,7 @@ const Report = Discourse.Model.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
_numberLabel(value, options = {}) {
|
_numberLabel(value, options = {}) {
|
||||||
const formatNumbers = Ember.isEmpty(options.formatNumbers)
|
const formatNumbers = isEmpty(options.formatNumbers)
|
||||||
? true
|
? true
|
||||||
: options.formatNumbers;
|
: options.formatNumbers;
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { or, gt } from "@ember/object/computed";
|
import { or, gt } from "@ember/object/computed";
|
||||||
import RestModel from "discourse/models/rest";
|
import RestModel from "discourse/models/rest";
|
||||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||||
|
@ -161,11 +162,11 @@ const Theme = RestModel.extend({
|
||||||
|
|
||||||
hasEdited(target, name) {
|
hasEdited(target, name) {
|
||||||
if (name) {
|
if (name) {
|
||||||
return !Ember.isEmpty(this.getField(target, name));
|
return !isEmpty(this.getField(target, name));
|
||||||
} else {
|
} else {
|
||||||
let fields = this.theme_fields || [];
|
let fields = this.theme_fields || [];
|
||||||
return fields.any(
|
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;
|
themeFields[key] = field;
|
||||||
} else {
|
} else {
|
||||||
const changed =
|
const changed =
|
||||||
(Ember.isEmpty(existingField.value) && !Ember.isEmpty(value)) ||
|
(isEmpty(existingField.value) && !isEmpty(value)) ||
|
||||||
(Ember.isEmpty(value) && !Ember.isEmpty(existingField.value));
|
(isEmpty(value) && !isEmpty(existingField.value));
|
||||||
|
|
||||||
existingField.value = value;
|
existingField.value = value;
|
||||||
if (changed) {
|
if (changed) {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import RestModel from "discourse/models/rest";
|
import RestModel from "discourse/models/rest";
|
||||||
import Category from "discourse/models/category";
|
import Category from "discourse/models/category";
|
||||||
import Group from "discourse/models/group";
|
import Group from "discourse/models/group";
|
||||||
|
@ -78,13 +79,13 @@ export default RestModel.extend({
|
||||||
wildcard_web_hook: this.wildcard_web_hook,
|
wildcard_web_hook: this.wildcard_web_hook,
|
||||||
verify_certificate: this.verify_certificate,
|
verify_certificate: this.verify_certificate,
|
||||||
active: this.active,
|
active: this.active,
|
||||||
web_hook_event_type_ids: Ember.isEmpty(types)
|
web_hook_event_type_ids: isEmpty(types)
|
||||||
? [null]
|
? [null]
|
||||||
: types.map(type => type.id),
|
: types.map(type => type.id),
|
||||||
category_ids: Ember.isEmpty(categoryIds) ? [null] : categoryIds,
|
category_ids: isEmpty(categoryIds) ? [null] : categoryIds,
|
||||||
tag_names: Ember.isEmpty(tagNames) ? [null] : tagNames,
|
tag_names: isEmpty(tagNames) ? [null] : tagNames,
|
||||||
group_ids:
|
group_ids:
|
||||||
Ember.isEmpty(groupNames) || Ember.isEmpty(groupNames[0])
|
isEmpty(groupNames) || isEmpty(groupNames[0])
|
||||||
? [null]
|
? [null]
|
||||||
: Discourse.Site.currentProp("groups").reduce((groupIds, g) => {
|
: Discourse.Site.currentProp("groups").reduce((groupIds, g) => {
|
||||||
if (groupNames.includes(g.name)) {
|
if (groupNames.includes(g.name)) {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default DiscourseRoute.extend({
|
||||||
|
@ -15,7 +16,7 @@ export default DiscourseRoute.extend({
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
if (
|
if (
|
||||||
model.get("isNew") ||
|
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"));
|
model.set("web_hook_event_types", controller.get("defaultEventTypes"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,6 +66,9 @@ var define, requirejs;
|
||||||
"@ember/service": {
|
"@ember/service": {
|
||||||
default: Ember.Service,
|
default: Ember.Service,
|
||||||
inject: Ember.inject.service
|
inject: Ember.inject.service
|
||||||
|
},
|
||||||
|
"@ember/utils": {
|
||||||
|
isEmpty: Ember.isEmpty
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import computed from "ember-addons/ember-computed-decorators";
|
import computed from "ember-addons/ember-computed-decorators";
|
||||||
|
|
||||||
|
@ -11,7 +12,7 @@ export default Component.extend({
|
||||||
@computed("categories.[].uploaded_logo.url")
|
@computed("categories.[].uploaded_logo.url")
|
||||||
anyLogos() {
|
anyLogos() {
|
||||||
return this.categories.any(c => {
|
return this.categories.any(c => {
|
||||||
return !Ember.isEmpty(c.get("uploaded_logo.url"));
|
return !isEmpty(c.get("uploaded_logo.url"));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import computed from "ember-addons/ember-computed-decorators";
|
import computed from "ember-addons/ember-computed-decorators";
|
||||||
import DiscourseURL from "discourse/lib/url";
|
import DiscourseURL from "discourse/lib/url";
|
||||||
|
@ -12,12 +13,12 @@ export default Component.extend({
|
||||||
|
|
||||||
@computed("categories.[].uploaded_logo.url")
|
@computed("categories.[].uploaded_logo.url")
|
||||||
anyLogos() {
|
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")
|
@computed("categories.[].subcategories")
|
||||||
hasSubcategories() {
|
hasSubcategories() {
|
||||||
return this.categories.any(c => !Ember.isEmpty(c.get("subcategories")));
|
return this.categories.any(c => !isEmpty(c.get("subcategories")));
|
||||||
},
|
},
|
||||||
|
|
||||||
click(e) {
|
click(e) {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { next } from "@ember/runloop";
|
import { next } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import debounce from "discourse/lib/debounce";
|
import debounce from "discourse/lib/debounce";
|
||||||
|
@ -31,7 +32,7 @@ export default Component.extend({
|
||||||
search: debounce(function(title) {
|
search: debounce(function(title) {
|
||||||
const currentTopicId = this.currentTopicId;
|
const currentTopicId = this.currentTopicId;
|
||||||
|
|
||||||
if (Ember.isEmpty(title)) {
|
if (isEmpty(title)) {
|
||||||
this.setProperties({ messages: null, loading: false });
|
this.setProperties({ messages: null, loading: false });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { next } from "@ember/runloop";
|
import { next } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import debounce from "discourse/lib/debounce";
|
import debounce from "discourse/lib/debounce";
|
||||||
|
@ -39,7 +40,7 @@ export default Component.extend({
|
||||||
|
|
||||||
const currentTopicId = this.currentTopicId;
|
const currentTopicId = this.currentTopicId;
|
||||||
|
|
||||||
if (Ember.isEmpty(title)) {
|
if (isEmpty(title)) {
|
||||||
this.setProperties({ topics: null, loading: false });
|
this.setProperties({ topics: null, loading: false });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { not } from "@ember/object/computed";
|
import { not } from "@ember/object/computed";
|
||||||
import { buildCategoryPanel } from "discourse/components/edit-category-panel";
|
import { buildCategoryPanel } from "discourse/components/edit-category-panel";
|
||||||
import { categoryBadgeHTML } from "discourse/helpers/category-link";
|
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
|
// We can change the parent if there are no children
|
||||||
@computed("category.id")
|
@computed("category.id")
|
||||||
subCategories(categoryId) {
|
subCategories(categoryId) {
|
||||||
if (Ember.isEmpty(categoryId)) {
|
if (isEmpty(categoryId)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return Category.list().filterBy("parent_category_id", categoryId);
|
return Category.list().filterBy("parent_category_id", categoryId);
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { alias, equal, or } from "@ember/object/computed";
|
import { alias, equal, or } from "@ember/object/computed";
|
||||||
import { schedule } from "@ember/runloop";
|
import { schedule } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
|
@ -34,7 +35,7 @@ export default Component.extend({
|
||||||
)
|
)
|
||||||
saveDisabled(updateTime, loading, publishToCategory, topicTimerCategoryId) {
|
saveDisabled(updateTime, loading, publishToCategory, topicTimerCategoryId) {
|
||||||
return (
|
return (
|
||||||
Ember.isEmpty(updateTime) ||
|
isEmpty(updateTime) ||
|
||||||
loading ||
|
loading ||
|
||||||
(publishToCategory && !topicTimerCategoryId)
|
(publishToCategory && !topicTimerCategoryId)
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { equal, and, empty } from "@ember/object/computed";
|
import { equal, and, empty } from "@ember/object/computed";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import {
|
import {
|
||||||
|
@ -108,7 +109,7 @@ export default Component.extend({
|
||||||
|
|
||||||
if (
|
if (
|
||||||
statusType === PUBLISH_TO_CATEGORY_STATUS_TYPE &&
|
statusType === PUBLISH_TO_CATEGORY_STATUS_TYPE &&
|
||||||
Ember.isEmpty(categoryId)
|
isEmpty(categoryId)
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { lte } from "@ember/object/computed";
|
import { lte } from "@ember/object/computed";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import computed from "ember-addons/ember-computed-decorators";
|
import computed from "ember-addons/ember-computed-decorators";
|
||||||
|
@ -62,7 +63,7 @@ export default Component.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
addMembers() {
|
addMembers() {
|
||||||
if (Ember.isEmpty(this.get("model.usernames"))) {
|
if (isEmpty(this.get("model.usernames"))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.model.addMembers(this.get("model.usernames")).catch(popupAjaxError);
|
this.model.addMembers(this.get("model.usernames")).catch(popupAjaxError);
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import {
|
import {
|
||||||
on,
|
on,
|
||||||
|
@ -27,7 +28,7 @@ export default Component.extend({
|
||||||
allowAny: false,
|
allowAny: false,
|
||||||
items: _.isArray(groupNames)
|
items: _.isArray(groupNames)
|
||||||
? groupNames
|
? groupNames
|
||||||
: Ember.isEmpty(groupNames)
|
: isEmpty(groupNames)
|
||||||
? []
|
? []
|
||||||
: [groupNames],
|
: [groupNames],
|
||||||
single: this.single,
|
single: this.single,
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { not } from "@ember/object/computed";
|
import { not } from "@ember/object/computed";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import {
|
import {
|
||||||
|
@ -65,7 +66,7 @@ export default Component.extend({
|
||||||
|
|
||||||
checkGroupName: debounce(function() {
|
checkGroupName: debounce(function() {
|
||||||
name = this.nameInput;
|
name = this.nameInput;
|
||||||
if (Ember.isEmpty(name)) return;
|
if (isEmpty(name)) return;
|
||||||
|
|
||||||
Group.checkName(name).then(response => {
|
Group.checkName(name).then(response => {
|
||||||
const validationName = "uniqueNameValidation";
|
const validationName = "uniqueNameValidation";
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { next } from "@ember/runloop";
|
import { next } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import computed from "ember-addons/ember-computed-decorators";
|
import computed from "ember-addons/ember-computed-decorators";
|
||||||
|
@ -30,7 +31,7 @@ export default Component.extend(UploadMixin, {
|
||||||
|
|
||||||
@computed("placeholderUrl")
|
@computed("placeholderUrl")
|
||||||
placeholderStyle(url) {
|
placeholderStyle(url) {
|
||||||
if (Ember.isEmpty(url)) {
|
if (isEmpty(url)) {
|
||||||
return "".htmlSafe();
|
return "".htmlSafe();
|
||||||
}
|
}
|
||||||
return `background-image: url(${url})`.htmlSafe();
|
return `background-image: url(${url})`.htmlSafe();
|
||||||
|
@ -38,7 +39,7 @@ export default Component.extend(UploadMixin, {
|
||||||
|
|
||||||
@computed("imageUrl")
|
@computed("imageUrl")
|
||||||
imageCDNURL(url) {
|
imageCDNURL(url) {
|
||||||
if (Ember.isEmpty(url)) {
|
if (isEmpty(url)) {
|
||||||
return "".htmlSafe();
|
return "".htmlSafe();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +53,7 @@ export default Component.extend(UploadMixin, {
|
||||||
|
|
||||||
@computed("imageUrl")
|
@computed("imageUrl")
|
||||||
imageBaseName(imageUrl) {
|
imageBaseName(imageUrl) {
|
||||||
if (Ember.isEmpty(imageUrl)) return;
|
if (isEmpty(imageUrl)) return;
|
||||||
return imageUrl.split("/").slice(-1)[0];
|
return imageUrl.split("/").slice(-1)[0];
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { alias, and, equal } from "@ember/object/computed";
|
import { alias, and, equal } from "@ember/object/computed";
|
||||||
import EmberObject from "@ember/object";
|
import EmberObject from "@ember/object";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
|
@ -48,7 +49,7 @@ export default Component.extend({
|
||||||
can_invite_to
|
can_invite_to
|
||||||
) {
|
) {
|
||||||
if (saving) return true;
|
if (saving) return true;
|
||||||
if (Ember.isEmpty(emailOrUsername)) return true;
|
if (isEmpty(emailOrUsername)) return true;
|
||||||
|
|
||||||
const emailTrimmed = emailOrUsername.trim();
|
const emailTrimmed = emailOrUsername.trim();
|
||||||
|
|
||||||
|
@ -65,7 +66,7 @@ export default Component.extend({
|
||||||
// when inviting to private topic via email, group name must be specified
|
// when inviting to private topic via email, group name must be specified
|
||||||
if (
|
if (
|
||||||
isPrivateTopic &&
|
isPrivateTopic &&
|
||||||
Ember.isEmpty(groupNames) &&
|
isEmpty(groupNames) &&
|
||||||
emailValid(emailTrimmed)
|
emailValid(emailTrimmed)
|
||||||
) {
|
) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -94,7 +95,7 @@ export default Component.extend({
|
||||||
) {
|
) {
|
||||||
if (hasCustomMessage) return true;
|
if (hasCustomMessage) return true;
|
||||||
if (saving) return true;
|
if (saving) return true;
|
||||||
if (Ember.isEmpty(emailOrUsername)) return true;
|
if (isEmpty(emailOrUsername)) return true;
|
||||||
|
|
||||||
const email = emailOrUsername.trim();
|
const email = emailOrUsername.trim();
|
||||||
|
|
||||||
|
@ -109,7 +110,7 @@ export default Component.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
// when inviting to private topic via email, group name must be specified
|
// 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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,7 +219,7 @@ export default Component.extend({
|
||||||
return I18n.t("topic.invite_reply.to_username");
|
return I18n.t("topic.invite_reply.to_username");
|
||||||
} else {
|
} else {
|
||||||
// when inviting to a topic, display instructions based on provided entity
|
// 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");
|
return I18n.t("topic.invite_reply.to_topic_blank");
|
||||||
} else if (emailValid(emailOrUsername)) {
|
} else if (emailValid(emailOrUsername)) {
|
||||||
this.set("inviteIcon", "envelope");
|
this.set("inviteIcon", "envelope");
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { alias } from "@ember/object/computed";
|
import { alias } from "@ember/object/computed";
|
||||||
import { schedule } from "@ember/runloop";
|
import { schedule } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
|
@ -27,7 +28,7 @@ export default Component.extend({
|
||||||
shareUrl(forcedShareUrl, shareUrl) {
|
shareUrl(forcedShareUrl, shareUrl) {
|
||||||
shareUrl = forcedShareUrl || shareUrl;
|
shareUrl = forcedShareUrl || shareUrl;
|
||||||
|
|
||||||
if (Ember.isEmpty(shareUrl)) {
|
if (isEmpty(shareUrl)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { bind } from "@ember/runloop";
|
import { bind } from "@ember/runloop";
|
||||||
import { scheduleOnce } from "@ember/runloop";
|
import { scheduleOnce } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
|
@ -59,7 +60,7 @@ export default Component.extend({
|
||||||
const $currentTargetOffset = $target.offset();
|
const $currentTargetOffset = $target.offset();
|
||||||
const $this = $(this.element);
|
const $this = $(this.element);
|
||||||
|
|
||||||
if (Ember.isEmpty(url)) {
|
if (isEmpty(url)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import computed from "ember-addons/ember-computed-decorators";
|
import computed from "ember-addons/ember-computed-decorators";
|
||||||
import { bufferedProperty } from "discourse/mixins/buffered-content";
|
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")
|
@computed("buffered.isSaving", "buffered.name", "buffered.tag_names")
|
||||||
savingDisabled(isSaving, name, tagNames) {
|
savingDisabled(isSaving, name, tagNames) {
|
||||||
return isSaving || Ember.isEmpty(name) || Ember.isEmpty(tagNames);
|
return isSaving || isEmpty(name) || isEmpty(tagNames);
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { alias, gte, and, gt, not, or } from "@ember/object/computed";
|
import { alias, gte, and, gt, not, or } from "@ember/object/computed";
|
||||||
import EmberObject from "@ember/object";
|
import EmberObject from "@ember/object";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
|
@ -69,7 +70,7 @@ export default Component.extend(CardContentsBase, CanCheckEmails, CleansUp, {
|
||||||
@computed("user.user_fields.@each.value")
|
@computed("user.user_fields.@each.value")
|
||||||
publicUserFields() {
|
publicUserFields() {
|
||||||
const siteUserFields = this.site.get("user_fields");
|
const siteUserFields = this.site.get("user_fields");
|
||||||
if (!Ember.isEmpty(siteUserFields)) {
|
if (!isEmpty(siteUserFields)) {
|
||||||
const userFields = this.get("user.user_fields");
|
const userFields = this.get("user.user_fields");
|
||||||
return siteUserFields
|
return siteUserFields
|
||||||
.filterBy("show_on_user_card", true)
|
.filterBy("show_on_user_card", true)
|
||||||
|
@ -77,7 +78,7 @@ export default Component.extend(CardContentsBase, CanCheckEmails, CleansUp, {
|
||||||
.map(field => {
|
.map(field => {
|
||||||
Ember.set(field, "dasherized_name", field.get("name").dasherize());
|
Ember.set(field, "dasherized_name", field.get("name").dasherize());
|
||||||
const value = userFields ? userFields[field.get("id")] : null;
|
const value = userFields ? userFields[field.get("id")] : null;
|
||||||
return Ember.isEmpty(value)
|
return isEmpty(value)
|
||||||
? null
|
? null
|
||||||
: EmberObject.create({ value, field });
|
: 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 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;
|
thisElem.style.backgroundImage = bg;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { on, observes } from "ember-addons/ember-computed-decorators";
|
import { on, observes } from "ember-addons/ember-computed-decorators";
|
||||||
import TextField from "discourse/components/text-field";
|
import TextField from "discourse/components/text-field";
|
||||||
import userSearch from "discourse/lib/user-search";
|
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
|
// THIS IS A HUGE HACK TO SUPPORT CLEARING THE INPUT
|
||||||
@observes("usernames")
|
@observes("usernames")
|
||||||
_clearInput() {
|
_clearInput() {
|
||||||
if (arguments.length > 1 && Ember.isEmpty(this.usernames)) {
|
if (arguments.length > 1 && isEmpty(this.usernames)) {
|
||||||
$(this.element)
|
$(this.element)
|
||||||
.parent()
|
.parent()
|
||||||
.find("a")
|
.find("a")
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||||
import computed from "ember-addons/ember-computed-decorators";
|
import computed from "ember-addons/ember-computed-decorators";
|
||||||
|
@ -13,7 +14,7 @@ export default Controller.extend(ModalFunctionality, {
|
||||||
|
|
||||||
@computed("saving", "notice")
|
@computed("saving", "notice")
|
||||||
disabled(saving, notice) {
|
disabled(saving, notice) {
|
||||||
return saving || Ember.isEmpty(notice);
|
return saving || isEmpty(notice);
|
||||||
},
|
},
|
||||||
|
|
||||||
onShow() {
|
onShow() {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { alias } from "@ember/object/computed";
|
import { alias } from "@ember/object/computed";
|
||||||
import { next } from "@ember/runloop";
|
import { next } from "@ember/runloop";
|
||||||
import { inject } from "@ember/controller";
|
import { inject } from "@ember/controller";
|
||||||
|
@ -17,7 +18,7 @@ export default Controller.extend(ModalFunctionality, {
|
||||||
|
|
||||||
@computed("saving", "new_user")
|
@computed("saving", "new_user")
|
||||||
buttonDisabled(saving, newUser) {
|
buttonDisabled(saving, newUser) {
|
||||||
return saving || Ember.isEmpty(newUser);
|
return saving || isEmpty(newUser);
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed("saving")
|
@computed("saving")
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { next } from "@ember/runloop";
|
import { next } from "@ember/runloop";
|
||||||
import { inject } from "@ember/controller";
|
import { inject } from "@ember/controller";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
|
@ -31,7 +32,7 @@ export default Controller.extend(ModalFunctionality, {
|
||||||
@computed("saving", "date", "validTimestamp")
|
@computed("saving", "date", "validTimestamp")
|
||||||
buttonDisabled(saving, date, validTimestamp) {
|
buttonDisabled(saving, date, validTimestamp) {
|
||||||
if (saving || validTimestamp) return true;
|
if (saving || validTimestamp) return true;
|
||||||
return Ember.isEmpty(date);
|
return isEmpty(date);
|
||||||
},
|
},
|
||||||
|
|
||||||
onShow() {
|
onShow() {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { and, or, alias, reads } from "@ember/object/computed";
|
import { and, or, alias, reads } from "@ember/object/computed";
|
||||||
import { debounce } from "@ember/runloop";
|
import { debounce } from "@ember/runloop";
|
||||||
import { inject as service } from "@ember/service";
|
import { inject as service } from "@ember/service";
|
||||||
|
@ -302,7 +303,7 @@ export default Controller.extend({
|
||||||
|
|
||||||
// We need exactly one user to issue a warning
|
// We need exactly one user to issue a warning
|
||||||
if (
|
if (
|
||||||
Ember.isEmpty(usernames) ||
|
isEmpty(usernames) ||
|
||||||
usernames.split(",").length !== 1 ||
|
usernames.split(",").length !== 1 ||
|
||||||
hasTargetGroups
|
hasTargetGroups
|
||||||
) {
|
) {
|
||||||
|
@ -441,8 +442,8 @@ export default Controller.extend({
|
||||||
this.closeAutocomplete();
|
this.closeAutocomplete();
|
||||||
|
|
||||||
if (
|
if (
|
||||||
Ember.isEmpty(this.get("model.reply")) &&
|
isEmpty(this.get("model.reply")) &&
|
||||||
Ember.isEmpty(this.get("model.title"))
|
isEmpty(this.get("model.title"))
|
||||||
) {
|
) {
|
||||||
this.close();
|
this.close();
|
||||||
} else {
|
} else {
|
||||||
|
@ -744,7 +745,7 @@ export default Controller.extend({
|
||||||
// Notify the composer messages controller that a reply has been typed. Some
|
// Notify the composer messages controller that a reply has been typed. Some
|
||||||
// messages only appear after typing.
|
// messages only appear after typing.
|
||||||
checkReplyLength() {
|
checkReplyLength() {
|
||||||
if (!Ember.isEmpty("model.reply")) {
|
if (!isEmpty("model.reply")) {
|
||||||
this.appEvents.trigger("composer:typed-reply");
|
this.appEvents.trigger("composer:typed-reply");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { notEmpty, or, not } from "@ember/object/computed";
|
import { notEmpty, or, not } from "@ember/object/computed";
|
||||||
import { inject } from "@ember/controller";
|
import { inject } from "@ember/controller";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
|
@ -91,7 +92,7 @@ export default Controller.extend(
|
||||||
|
|
||||||
@computed("authOptions.auth_provider")
|
@computed("authOptions.auth_provider")
|
||||||
passwordRequired(authProvider) {
|
passwordRequired(authProvider) {
|
||||||
return Ember.isEmpty(authProvider);
|
return isEmpty(authProvider);
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed
|
@computed
|
||||||
|
@ -108,7 +109,7 @@ export default Controller.extend(
|
||||||
@computed("accountEmail", "rejectedEmails.[]")
|
@computed("accountEmail", "rejectedEmails.[]")
|
||||||
emailValidation(email, rejectedEmails) {
|
emailValidation(email, rejectedEmails) {
|
||||||
// If blank, fail without a reason
|
// If blank, fail without a reason
|
||||||
if (Ember.isEmpty(email)) {
|
if (isEmpty(email)) {
|
||||||
return InputValidation.create({
|
return InputValidation.create({
|
||||||
failed: true
|
failed: true
|
||||||
});
|
});
|
||||||
|
@ -176,7 +177,7 @@ export default Controller.extend(
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
this.get("emailValidation.ok") &&
|
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,
|
// If email is valid and username has not been entered yet,
|
||||||
// or email and username were filled automatically by 3rd parth auth,
|
// or email and username were filled automatically by 3rd parth auth,
|
||||||
|
@ -226,12 +227,12 @@ export default Controller.extend(
|
||||||
const userFields = this.userFields;
|
const userFields = this.userFields;
|
||||||
const destinationUrl = this.get("authOptions.destination_url");
|
const destinationUrl = this.get("authOptions.destination_url");
|
||||||
|
|
||||||
if (!Ember.isEmpty(destinationUrl)) {
|
if (!isEmpty(destinationUrl)) {
|
||||||
$.cookie("destination_url", destinationUrl, { path: "/" });
|
$.cookie("destination_url", destinationUrl, { path: "/" });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the userfields to the data
|
// Add the userfields to the data
|
||||||
if (!Ember.isEmpty(userFields)) {
|
if (!isEmpty(userFields)) {
|
||||||
attrs.userFields = {};
|
attrs.userFields = {};
|
||||||
userFields.forEach(
|
userFields.forEach(
|
||||||
f => (attrs.userFields[f.get("field.id")] = f.get("value"))
|
f => (attrs.userFields[f.get("field.id")] = f.get("value"))
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||||
import DiscourseURL from "discourse/lib/url";
|
import DiscourseURL from "discourse/lib/url";
|
||||||
|
@ -31,7 +32,7 @@ export default Controller.extend(ModalFunctionality, {
|
||||||
|
|
||||||
@observes("model.description")
|
@observes("model.description")
|
||||||
changeSize() {
|
changeSize() {
|
||||||
if (!Ember.isEmpty(this.get("model.description"))) {
|
if (!isEmpty(this.get("model.description"))) {
|
||||||
this.set("modal.modalClass", "edit-category-modal full");
|
this.set("modal.modalClass", "edit-category-modal full");
|
||||||
} else {
|
} else {
|
||||||
this.set("modal.modalClass", "edit-category-modal small");
|
this.set("modal.modalClass", "edit-category-modal small");
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||||
|
@ -11,7 +12,7 @@ export default Controller.extend(ModalFunctionality, {
|
||||||
|
|
||||||
@computed("accountEmailOrUsername", "disabled")
|
@computed("accountEmailOrUsername", "disabled")
|
||||||
submitDisabled(accountEmailOrUsername, disabled) {
|
submitDisabled(accountEmailOrUsername, disabled) {
|
||||||
return Ember.isEmpty((accountEmailOrUsername || "").trim()) || disabled;
|
return isEmpty((accountEmailOrUsername || "").trim()) || disabled;
|
||||||
},
|
},
|
||||||
|
|
||||||
onShow() {
|
onShow() {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { or } from "@ember/object/computed";
|
import { or } from "@ember/object/computed";
|
||||||
import { inject } from "@ember/controller";
|
import { inject } from "@ember/controller";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
|
@ -54,7 +55,7 @@ export default Controller.extend({
|
||||||
|
|
||||||
@computed("q")
|
@computed("q")
|
||||||
hasAutofocus(q) {
|
hasAutofocus(q) {
|
||||||
return Ember.isEmpty(q);
|
return isEmpty(q);
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed("q")
|
@computed("q")
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import computed from "ember-addons/ember-computed-decorators";
|
import computed from "ember-addons/ember-computed-decorators";
|
||||||
import { extractError } from "discourse/lib/ajax-error";
|
import { extractError } from "discourse/lib/ajax-error";
|
||||||
|
@ -18,7 +19,7 @@ export default Controller.extend(ModalFunctionality, {
|
||||||
|
|
||||||
const model = this.model;
|
const model = this.model;
|
||||||
const usernames = model.get("usernames");
|
const usernames = model.get("usernames");
|
||||||
if (Ember.isEmpty(usernames)) {
|
if (isEmpty(usernames)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let promise;
|
let promise;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import computed from "ember-addons/ember-computed-decorators";
|
import computed from "ember-addons/ember-computed-decorators";
|
||||||
import { extractError } from "discourse/lib/ajax-error";
|
import { extractError } from "discourse/lib/ajax-error";
|
||||||
|
@ -9,7 +10,7 @@ export default Controller.extend(ModalFunctionality, {
|
||||||
|
|
||||||
@computed("input", "loading", "result")
|
@computed("input", "loading", "result")
|
||||||
disableAddButton(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: {
|
actions: {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { debounce } from "@ember/runloop";
|
import { debounce } from "@ember/runloop";
|
||||||
import { cancel } from "@ember/runloop";
|
import { cancel } from "@ember/runloop";
|
||||||
import { scheduleOnce } from "@ember/runloop";
|
import { scheduleOnce } from "@ember/runloop";
|
||||||
|
@ -148,7 +149,7 @@ export default Controller.extend(ModalFunctionality, {
|
||||||
origLink.indexOf("://") === -1 ? `http://${origLink}` : origLink;
|
origLink.indexOf("://") === -1 ? `http://${origLink}` : origLink;
|
||||||
const sel = this._lastSel;
|
const sel = this._lastSel;
|
||||||
|
|
||||||
if (Ember.isEmpty(linkUrl)) {
|
if (isEmpty(linkUrl)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { alias, notEmpty } from "@ember/object/computed";
|
import { alias, notEmpty } from "@ember/object/computed";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||||
|
@ -68,7 +69,7 @@ export default Controller.extend(
|
||||||
submit() {
|
submit() {
|
||||||
const userFields = this.userFields;
|
const userFields = this.userFields;
|
||||||
let userCustomFields = {};
|
let userCustomFields = {};
|
||||||
if (!Ember.isEmpty(userFields)) {
|
if (!isEmpty(userFields)) {
|
||||||
userFields.forEach(function(f) {
|
userFields.forEach(function(f) {
|
||||||
userCustomFields[f.get("field.id")] = f.get("value");
|
userCustomFields[f.get("field.id")] = f.get("value");
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { alias, or, readOnly } from "@ember/object/computed";
|
import { alias, or, readOnly } from "@ember/object/computed";
|
||||||
import EmberObject from "@ember/object";
|
import EmberObject from "@ember/object";
|
||||||
import { next } from "@ember/runloop";
|
import { next } from "@ember/runloop";
|
||||||
|
@ -107,7 +108,7 @@ export default Controller.extend(ModalFunctionality, {
|
||||||
return;
|
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");
|
this.flash(I18n.t("login.blank_username_or_password"), "error");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -273,7 +274,7 @@ export default Controller.extend(ModalFunctionality, {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Ember.isEmpty(this.loginName)) {
|
if (isEmpty(this.loginName)) {
|
||||||
this.flash(I18n.t("login.blank_username"), "error");
|
this.flash(I18n.t("login.blank_username"), "error");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { alias, equal } from "@ember/object/computed";
|
import { alias, equal } from "@ember/object/computed";
|
||||||
import { next } from "@ember/runloop";
|
import { next } from "@ember/runloop";
|
||||||
import { inject } from "@ember/controller";
|
import { inject } from "@ember/controller";
|
||||||
|
@ -48,7 +49,7 @@ export default Controller.extend(ModalFunctionality, {
|
||||||
@computed("saving", "selectedTopicId", "topicName")
|
@computed("saving", "selectedTopicId", "topicName")
|
||||||
buttonDisabled(saving, selectedTopicId, topicName) {
|
buttonDisabled(saving, selectedTopicId, topicName) {
|
||||||
return (
|
return (
|
||||||
saving || (Ember.isEmpty(selectedTopicId) && Ember.isEmpty(topicName))
|
saving || (isEmpty(selectedTopicId) && isEmpty(topicName))
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { not, or, gt } from "@ember/object/computed";
|
import { not, or, gt } from "@ember/object/computed";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import { iconHTML } from "discourse-common/lib/icon-library";
|
import { iconHTML } from "discourse-common/lib/icon-library";
|
||||||
|
@ -241,7 +242,7 @@ export default Controller.extend(CanCheckEmails, PreferencesTabController, {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
if (!token) {
|
if (!token) {
|
||||||
const redirect = this.siteSettings.logout_redirect;
|
const redirect = this.siteSettings.logout_redirect;
|
||||||
if (Ember.isEmpty(redirect)) {
|
if (isEmpty(redirect)) {
|
||||||
window.location = Discourse.getURL("/");
|
window.location = Discourse.getURL("/");
|
||||||
} else {
|
} else {
|
||||||
window.location.href = redirect;
|
window.location.href = redirect;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import EmberObject from "@ember/object";
|
import EmberObject from "@ember/object";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
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")
|
@computed("model.user_fields.@each.value")
|
||||||
userFields() {
|
userFields() {
|
||||||
let siteUserFields = this.site.get("user_fields");
|
let siteUserFields = this.site.get("user_fields");
|
||||||
if (!Ember.isEmpty(siteUserFields)) {
|
if (!isEmpty(siteUserFields)) {
|
||||||
const userFields = this.get("model.user_fields");
|
const userFields = this.get("model.user_fields");
|
||||||
|
|
||||||
// Staff can edit fields that are not `editable`
|
// Staff can edit fields that are not `editable`
|
||||||
|
@ -53,9 +54,9 @@ export default Controller.extend(PreferencesTabController, {
|
||||||
userFields = this.userFields;
|
userFields = this.userFields;
|
||||||
|
|
||||||
// Update the user fields
|
// Update the user fields
|
||||||
if (!Ember.isEmpty(userFields)) {
|
if (!isEmpty(userFields)) {
|
||||||
const modelFields = model.get("user_fields");
|
const modelFields = model.get("user_fields");
|
||||||
if (!Ember.isEmpty(modelFields)) {
|
if (!isEmpty(modelFields)) {
|
||||||
userFields.forEach(function(uf) {
|
userFields.forEach(function(uf) {
|
||||||
modelFields[uf.get("field.id").toString()] = uf.get("value");
|
modelFields[uf.get("field.id").toString()] = uf.get("value");
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { empty, or } from "@ember/object/computed";
|
import { empty, or } from "@ember/object/computed";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import {
|
import {
|
||||||
|
@ -37,7 +38,7 @@ export default Controller.extend({
|
||||||
this.set("taken", false);
|
this.set("taken", false);
|
||||||
this.set("errorMessage", null);
|
this.set("errorMessage", null);
|
||||||
|
|
||||||
if (Ember.isEmpty(this.newUsername)) return;
|
if (isEmpty(this.newUsername)) return;
|
||||||
if (this.unchanged) return;
|
if (this.unchanged) return;
|
||||||
|
|
||||||
Discourse.User.checkUsername(
|
Discourse.User.checkUsername(
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { alias } from "@ember/object/computed";
|
import { alias } from "@ember/object/computed";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import computed from "ember-addons/ember-computed-decorators";
|
import computed from "ember-addons/ember-computed-decorators";
|
||||||
|
@ -16,7 +17,7 @@ export default Controller.extend(ModalFunctionality, {
|
||||||
|
|
||||||
@computed("loading", "reason")
|
@computed("loading", "reason")
|
||||||
disableSubmit(loading, reason) {
|
disableSubmit(loading, reason) {
|
||||||
return loading || Ember.isEmpty(reason);
|
return loading || isEmpty(reason);
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { or, and, not, alias } from "@ember/object/computed";
|
import { or, and, not, alias } from "@ember/object/computed";
|
||||||
import EmberObject from "@ember/object";
|
import EmberObject from "@ember/object";
|
||||||
import { next } from "@ember/runloop";
|
import { next } from "@ember/runloop";
|
||||||
|
@ -72,7 +73,7 @@ export default Controller.extend(bufferedProperty("model"), {
|
||||||
@observes("model.title", "category")
|
@observes("model.title", "category")
|
||||||
_titleChanged() {
|
_titleChanged() {
|
||||||
const title = this.get("model.title");
|
const title = this.get("model.title");
|
||||||
if (!Ember.isEmpty(title)) {
|
if (!isEmpty(title)) {
|
||||||
// force update lazily loaded titles
|
// force update lazily loaded titles
|
||||||
this.send("refreshTitle");
|
this.send("refreshTitle");
|
||||||
}
|
}
|
||||||
|
@ -985,7 +986,7 @@ export default Controller.extend(bufferedProperty("model"), {
|
||||||
composerController
|
composerController
|
||||||
.open(options)
|
.open(options)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return Ember.isEmpty(quotedText) ? "" : quotedText;
|
return isEmpty(quotedText) ? "" : quotedText;
|
||||||
})
|
})
|
||||||
.then(q => {
|
.then(q => {
|
||||||
const postUrl = `${location.protocol}//${location.host}${post.get(
|
const postUrl = `${location.protocol}//${location.host}${post.get(
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { alias, or, gt, not, and } from "@ember/object/computed";
|
import { alias, or, gt, not, and } from "@ember/object/computed";
|
||||||
import EmberObject from "@ember/object";
|
import EmberObject from "@ember/object";
|
||||||
import { inject as service } from "@ember/service";
|
import { inject as service } from "@ember/service";
|
||||||
|
@ -29,7 +30,7 @@ export default Controller.extend(CanCheckEmails, {
|
||||||
|
|
||||||
@computed("model.profileBackgroundUrl")
|
@computed("model.profileBackgroundUrl")
|
||||||
hasProfileBackgroundUrl(background) {
|
hasProfileBackgroundUrl(background) {
|
||||||
return !Ember.isEmpty(background.toString());
|
return !isEmpty(background.toString());
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed("model.profile_hidden", "indexStream", "viewingSelf", "forceExpand")
|
@computed("model.profile_hidden", "indexStream", "viewingSelf", "forceExpand")
|
||||||
|
@ -108,7 +109,7 @@ export default Controller.extend(CanCheckEmails, {
|
||||||
@computed("model.user_fields.@each.value")
|
@computed("model.user_fields.@each.value")
|
||||||
publicUserFields() {
|
publicUserFields() {
|
||||||
const siteUserFields = this.site.get("user_fields");
|
const siteUserFields = this.site.get("user_fields");
|
||||||
if (!Ember.isEmpty(siteUserFields)) {
|
if (!isEmpty(siteUserFields)) {
|
||||||
const userFields = this.get("model.user_fields");
|
const userFields = this.get("model.user_fields");
|
||||||
return siteUserFields
|
return siteUserFields
|
||||||
.filterBy("show_on_profile", true)
|
.filterBy("show_on_profile", true)
|
||||||
|
@ -118,7 +119,7 @@ export default Controller.extend(CanCheckEmails, {
|
||||||
const value = userFields
|
const value = userFields
|
||||||
? userFields[field.get("id").toString()]
|
? userFields[field.get("id").toString()]
|
||||||
: null;
|
: null;
|
||||||
return Ember.isEmpty(value)
|
return isEmpty(value)
|
||||||
? null
|
? null
|
||||||
: EmberObject.create({ value, field });
|
: EmberObject.create({ value, field });
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { htmlHelper } from "discourse-common/lib/helpers";
|
import { htmlHelper } from "discourse-common/lib/helpers";
|
||||||
import { avatarImg } from "discourse/lib/utilities";
|
import { avatarImg } from "discourse/lib/utilities";
|
||||||
|
|
||||||
export default htmlHelper((avatarTemplate, size) => {
|
export default htmlHelper((avatarTemplate, size) => {
|
||||||
if (Ember.isEmpty(avatarTemplate)) {
|
if (isEmpty(avatarTemplate)) {
|
||||||
return "<div class='avatar-placeholder'></div>";
|
return "<div class='avatar-placeholder'></div>";
|
||||||
} else {
|
} else {
|
||||||
return avatarImg({ size, avatarTemplate });
|
return avatarImg({ size, avatarTemplate });
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { htmlHelper } from "discourse-common/lib/helpers";
|
import { htmlHelper } from "discourse-common/lib/helpers";
|
||||||
import { avatarImg } from "discourse/lib/utilities";
|
import { avatarImg } from "discourse/lib/utilities";
|
||||||
import { addExtraUserClasses } from "discourse/helpers/user-avatar";
|
import { addExtraUserClasses } from "discourse/helpers/user-avatar";
|
||||||
|
|
||||||
export default htmlHelper((user, size) => {
|
export default htmlHelper((user, size) => {
|
||||||
if (Ember.isEmpty(user)) {
|
if (isEmpty(user)) {
|
||||||
return "<div class='avatar-placeholder'></div>";
|
return "<div class='avatar-placeholder'></div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { htmlHelper } from "discourse-common/lib/helpers";
|
import { htmlHelper } from "discourse-common/lib/helpers";
|
||||||
|
|
||||||
export default htmlHelper(str => (Ember.isEmpty(str) ? "—" : str));
|
export default htmlHelper(str => (isEmpty(str) ? "—" : str));
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { htmlHelper } from "discourse-common/lib/helpers";
|
import { htmlHelper } from "discourse-common/lib/helpers";
|
||||||
import { iconHTML, convertIconClass } from "discourse-common/lib/icon-library";
|
import { iconHTML, convertIconClass } from "discourse-common/lib/icon-library";
|
||||||
|
|
||||||
export default htmlHelper(function({ icon, image }) {
|
export default htmlHelper(function({ icon, image }) {
|
||||||
if (!Ember.isEmpty(image)) {
|
if (!isEmpty(image)) {
|
||||||
return `<img src='${image}'>`;
|
return `<img src='${image}'>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Ember.isEmpty(icon)) {
|
if (isEmpty(icon)) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
export default function logout(siteSettings, keyValueStore) {
|
export default function logout(siteSettings, keyValueStore) {
|
||||||
if (!siteSettings || !keyValueStore) {
|
if (!siteSettings || !keyValueStore) {
|
||||||
const container = Discourse.__container__;
|
const container = Discourse.__container__;
|
||||||
|
@ -8,7 +9,7 @@ export default function logout(siteSettings, keyValueStore) {
|
||||||
keyValueStore.abandonLocal();
|
keyValueStore.abandonLocal();
|
||||||
|
|
||||||
const redirect = siteSettings.logout_redirect;
|
const redirect = siteSettings.logout_redirect;
|
||||||
if (Ember.isEmpty(redirect)) {
|
if (isEmpty(redirect)) {
|
||||||
window.location = Discourse.getURL("/");
|
window.location = Discourse.getURL("/");
|
||||||
} else {
|
} else {
|
||||||
window.location.href = redirect;
|
window.location.href = redirect;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import EmberObject from "@ember/object";
|
import EmberObject from "@ember/object";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
import { findRawTemplate } from "discourse/lib/raw-templates";
|
import { findRawTemplate } from "discourse/lib/raw-templates";
|
||||||
|
@ -53,7 +54,7 @@ export function translateResults(results, opts) {
|
||||||
const fullName = Handlebars.Utils.escapeExpression(
|
const fullName = Handlebars.Utils.escapeExpression(
|
||||||
group.full_name || group.display_name
|
group.full_name || group.display_name
|
||||||
);
|
);
|
||||||
const flairUrl = Ember.isEmpty(group.flair_url)
|
const flairUrl = isEmpty(group.flair_url)
|
||||||
? null
|
? null
|
||||||
: Handlebars.Utils.escapeExpression(group.flair_url);
|
: Handlebars.Utils.escapeExpression(group.flair_url);
|
||||||
const flairColor = Handlebars.Utils.escapeExpression(group.flair_color);
|
const flairColor = Handlebars.Utils.escapeExpression(group.flair_color);
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { userPath } from "discourse/lib/url";
|
import { userPath } from "discourse/lib/url";
|
||||||
|
|
||||||
const _additionalAttributes = [];
|
const _additionalAttributes = [];
|
||||||
|
@ -48,7 +49,7 @@ export function transformBasicPost(post) {
|
||||||
showFlagDelete: false,
|
showFlagDelete: false,
|
||||||
canRecover: post.can_recover,
|
canRecover: post.can_recover,
|
||||||
canEdit: post.can_edit,
|
canEdit: post.can_edit,
|
||||||
canFlag: !Ember.isEmpty(post.get("flagsAvailable")),
|
canFlag: !isEmpty(post.get("flagsAvailable")),
|
||||||
canReviewTopic: false,
|
canReviewTopic: false,
|
||||||
reviewableId: post.reviewable_id,
|
reviewableId: post.reviewable_id,
|
||||||
reviewableScoreCount: post.reviewable_score_count,
|
reviewableScoreCount: post.reviewable_score_count,
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import EmberObject from "@ember/object";
|
import EmberObject from "@ember/object";
|
||||||
import { next } from "@ember/runloop";
|
import { next } from "@ember/runloop";
|
||||||
import { schedule } from "@ember/runloop";
|
import { schedule } from "@ember/runloop";
|
||||||
|
@ -62,7 +63,7 @@ export function groupPath(subPath) {
|
||||||
|
|
||||||
let _jumpScheduled = false;
|
let _jumpScheduled = false;
|
||||||
export function jumpToElement(elementId) {
|
export function jumpToElement(elementId) {
|
||||||
if (_jumpScheduled || Ember.isEmpty(elementId)) {
|
if (_jumpScheduled || isEmpty(elementId)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +192,7 @@ const DiscourseURL = EmberObject.extend({
|
||||||
routeTo(path, opts) {
|
routeTo(path, opts) {
|
||||||
opts = opts || {};
|
opts = opts || {};
|
||||||
|
|
||||||
if (Ember.isEmpty(path)) {
|
if (isEmpty(path)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import InputValidation from "discourse/models/input-validation";
|
import InputValidation from "discourse/models/input-validation";
|
||||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||||
import Mixin from "@ember/object/mixin";
|
import Mixin from "@ember/object/mixin";
|
||||||
|
@ -17,7 +18,7 @@ export default Mixin.create({
|
||||||
nameValidation() {
|
nameValidation() {
|
||||||
if (
|
if (
|
||||||
this.siteSettings.full_name_required &&
|
this.siteSettings.full_name_required &&
|
||||||
Ember.isEmpty(this.accountName)
|
isEmpty(this.accountName)
|
||||||
) {
|
) {
|
||||||
return InputValidation.create({ failed: true });
|
return InputValidation.create({ failed: true });
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import InputValidation from "discourse/models/input-validation";
|
import InputValidation from "discourse/models/input-validation";
|
||||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||||
import Mixin from "@ember/object/mixin";
|
import Mixin from "@ember/object/mixin";
|
||||||
|
@ -55,7 +56,7 @@ export default Mixin.create({
|
||||||
}
|
}
|
||||||
|
|
||||||
// If blank, fail without a reason
|
// If blank, fail without a reason
|
||||||
if (Ember.isEmpty(password)) {
|
if (isEmpty(password)) {
|
||||||
return InputValidation.create({ failed: true });
|
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({
|
return InputValidation.create({
|
||||||
failed: true,
|
failed: true,
|
||||||
reason: I18n.t("user.password.same_as_username")
|
reason: I18n.t("user.password.same_as_username")
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Ember.isEmpty(accountEmail) && password === accountEmail) {
|
if (!isEmpty(accountEmail) && password === accountEmail) {
|
||||||
return InputValidation.create({
|
return InputValidation.create({
|
||||||
failed: true,
|
failed: true,
|
||||||
reason: I18n.t("user.password.same_as_email")
|
reason: I18n.t("user.password.same_as_email")
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import EmberObject from "@ember/object";
|
import EmberObject from "@ember/object";
|
||||||
import InputValidation from "discourse/models/input-validation";
|
import InputValidation from "discourse/models/input-validation";
|
||||||
import {
|
import {
|
||||||
|
@ -29,10 +30,10 @@ export default Mixin.create({
|
||||||
if (userFields) {
|
if (userFields) {
|
||||||
userFields = userFields.filterBy("field.required");
|
userFields = userFields.filterBy("field.required");
|
||||||
}
|
}
|
||||||
if (!Ember.isEmpty(userFields)) {
|
if (!isEmpty(userFields)) {
|
||||||
const anyEmpty = userFields.any(uf => {
|
const anyEmpty = userFields.any(uf => {
|
||||||
const val = uf.get("value");
|
const val = uf.get("value");
|
||||||
return !val || Ember.isEmpty(val);
|
return !val || isEmpty(val);
|
||||||
});
|
});
|
||||||
if (anyEmpty) {
|
if (anyEmpty) {
|
||||||
return InputValidation.create({ failed: true });
|
return InputValidation.create({ failed: true });
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import InputValidation from "discourse/models/input-validation";
|
import InputValidation from "discourse/models/input-validation";
|
||||||
import debounce from "discourse/lib/debounce";
|
import debounce from "discourse/lib/debounce";
|
||||||
import { setting } from "discourse/lib/computed";
|
import { setting } from "discourse/lib/computed";
|
||||||
|
@ -15,7 +16,7 @@ export default Mixin.create({
|
||||||
Discourse.User.checkUsername(null, this.accountEmail).then(result => {
|
Discourse.User.checkUsername(null, this.accountEmail).then(result => {
|
||||||
if (
|
if (
|
||||||
result.suggestion &&
|
result.suggestion &&
|
||||||
(Ember.isEmpty(this.accountUsername) ||
|
(isEmpty(this.accountUsername) ||
|
||||||
this.accountUsername === this.get("authOptions.username"))
|
this.accountUsername === this.get("authOptions.username"))
|
||||||
) {
|
) {
|
||||||
this.setProperties({
|
this.setProperties({
|
||||||
|
@ -38,7 +39,7 @@ export default Mixin.create({
|
||||||
}
|
}
|
||||||
|
|
||||||
// If blank, fail without a reason
|
// If blank, fail without a reason
|
||||||
if (Ember.isEmpty(accountUsername)) {
|
if (isEmpty(accountUsername)) {
|
||||||
return InputValidation.create({ failed: true });
|
return InputValidation.create({ failed: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +69,7 @@ export default Mixin.create({
|
||||||
|
|
||||||
shouldCheckUsernameAvailability() {
|
shouldCheckUsernameAvailability() {
|
||||||
return (
|
return (
|
||||||
!Ember.isEmpty(this.accountUsername) &&
|
!isEmpty(this.accountUsername) &&
|
||||||
this.accountUsername.length >= this.minUsernameLength
|
this.accountUsername.length >= this.minUsernameLength
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { reads, equal, not, or, and } from "@ember/object/computed";
|
import { reads, equal, not, or, and } from "@ember/object/computed";
|
||||||
import EmberObject from "@ember/object";
|
import EmberObject from "@ember/object";
|
||||||
import { next } from "@ember/runloop";
|
import { next } from "@ember/runloop";
|
||||||
|
@ -116,7 +117,7 @@ const Composer = RestModel.extend({
|
||||||
set(categoryId) {
|
set(categoryId) {
|
||||||
const oldCategoryId = this._categoryId;
|
const oldCategoryId = this._categoryId;
|
||||||
|
|
||||||
if (Ember.isEmpty(categoryId)) {
|
if (isEmpty(categoryId)) {
|
||||||
categoryId = null;
|
categoryId = null;
|
||||||
}
|
}
|
||||||
this._categoryId = categoryId;
|
this._categoryId = categoryId;
|
||||||
|
@ -420,7 +421,7 @@ const Composer = RestModel.extend({
|
||||||
|
|
||||||
@computed("metaData")
|
@computed("metaData")
|
||||||
hasMetaData(metaData) {
|
hasMetaData(metaData) {
|
||||||
return metaData ? Ember.isEmpty(Ember.keys(metaData)) : false;
|
return metaData ? isEmpty(Ember.keys(metaData)) : false;
|
||||||
},
|
},
|
||||||
|
|
||||||
replyDirty: propertyNotEqual("reply", "originalText"),
|
replyDirty: propertyNotEqual("reply", "originalText"),
|
||||||
|
@ -610,7 +611,7 @@ const Composer = RestModel.extend({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Ember.isEmpty(reply)) {
|
if (!isEmpty(reply)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -633,7 +634,7 @@ const Composer = RestModel.extend({
|
||||||
if (!opts) opts = {};
|
if (!opts) opts = {};
|
||||||
this.set("loading", false);
|
this.set("loading", false);
|
||||||
|
|
||||||
const replyBlank = Ember.isEmpty(this.reply);
|
const replyBlank = isEmpty(this.reply);
|
||||||
|
|
||||||
const composer = this;
|
const composer = this;
|
||||||
if (
|
if (
|
||||||
|
@ -1055,7 +1056,7 @@ const Composer = RestModel.extend({
|
||||||
|
|
||||||
let data = this.serialize(_draft_serializer);
|
let data = this.serialize(_draft_serializer);
|
||||||
|
|
||||||
if (data.postId && !Ember.isEmpty(this.originalText)) {
|
if (data.postId && !isEmpty(this.originalText)) {
|
||||||
data.originalText = this.originalText;
|
data.originalText = this.originalText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { notEmpty, equal } from "@ember/object/computed";
|
import { notEmpty, equal } from "@ember/object/computed";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
import {
|
import {
|
||||||
|
@ -27,7 +28,7 @@ const Group = RestModel.extend({
|
||||||
|
|
||||||
@computed("automatic_membership_email_domains")
|
@computed("automatic_membership_email_domains")
|
||||||
emailDomains(value) {
|
emailDomains(value) {
|
||||||
return Ember.isEmpty(value) ? "" : value;
|
return isEmpty(value) ? "" : value;
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed("automatic")
|
@computed("automatic")
|
||||||
|
@ -44,7 +45,7 @@ const Group = RestModel.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
findMembers(params) {
|
findMembers(params) {
|
||||||
if (Ember.isEmpty(this.name) || !this.can_see_members) {
|
if (isEmpty(this.name) || !this.can_see_members) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import EmberObject from "@ember/object";
|
import EmberObject from "@ember/object";
|
||||||
const Model = EmberObject.extend();
|
const Model = EmberObject.extend();
|
||||||
|
|
||||||
Model.reopenClass({
|
Model.reopenClass({
|
||||||
extractByKey(collection, klass) {
|
extractByKey(collection, klass) {
|
||||||
const retval = {};
|
const retval = {};
|
||||||
if (Ember.isEmpty(collection)) {
|
if (isEmpty(collection)) {
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { or, not, and } from "@ember/object/computed";
|
import { or, not, and } from "@ember/object/computed";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
import DiscourseURL from "discourse/lib/url";
|
import DiscourseURL from "discourse/lib/url";
|
||||||
|
@ -114,7 +115,7 @@ export default RestModel.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
const userFilters = this.userFilters;
|
const userFilters = this.userFilters;
|
||||||
if (!Ember.isEmpty(userFilters)) {
|
if (!isEmpty(userFilters)) {
|
||||||
result.username_filters = userFilters.join(",");
|
result.username_filters = userFilters.join(",");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,7 +362,7 @@ export default RestModel.extend({
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
const postIds = this.nextWindow;
|
const postIds = this.nextWindow;
|
||||||
if (Ember.isEmpty(postIds)) return Ember.RSVP.resolve();
|
if (isEmpty(postIds)) return Ember.RSVP.resolve();
|
||||||
this.set("loadingBelow", true);
|
this.set("loadingBelow", true);
|
||||||
postsWithPlaceholders.appending(postIds);
|
postsWithPlaceholders.appending(postIds);
|
||||||
|
|
||||||
|
@ -402,7 +403,7 @@ export default RestModel.extend({
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
const postIds = this.previousWindow;
|
const postIds = this.previousWindow;
|
||||||
if (Ember.isEmpty(postIds)) return Ember.RSVP.resolve();
|
if (isEmpty(postIds)) return Ember.RSVP.resolve();
|
||||||
this.set("loadingAbove", true);
|
this.set("loadingAbove", true);
|
||||||
|
|
||||||
return this.findPostsByIds(postIds.reverse())
|
return this.findPostsByIds(postIds.reverse())
|
||||||
|
@ -520,7 +521,7 @@ export default RestModel.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
removePosts(posts) {
|
removePosts(posts) {
|
||||||
if (Ember.isEmpty(posts)) {
|
if (isEmpty(posts)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -955,7 +956,7 @@ export default RestModel.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
loadIntoIdentityMap(postIds) {
|
loadIntoIdentityMap(postIds) {
|
||||||
if (Ember.isEmpty(postIds)) {
|
if (isEmpty(postIds)) {
|
||||||
return Ember.RSVP.resolve([]);
|
return Ember.RSVP.resolve([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { equal, and, or, not } from "@ember/object/computed";
|
import { equal, and, or, not } from "@ember/object/computed";
|
||||||
import EmberObject from "@ember/object";
|
import EmberObject from "@ember/object";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
|
@ -93,7 +94,7 @@ const Post = RestModel.extend({
|
||||||
|
|
||||||
@computed("link_counts.@each.internal")
|
@computed("link_counts.@each.internal")
|
||||||
internalLinks() {
|
internalLinks() {
|
||||||
if (Ember.isEmpty(this.link_counts)) return null;
|
if (isEmpty(this.link_counts)) return null;
|
||||||
|
|
||||||
return this.link_counts.filterBy("internal").filterBy("title");
|
return this.link_counts.filterBy("internal").filterBy("title");
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { alias, sort } from "@ember/object/computed";
|
import { alias, sort } from "@ember/object/computed";
|
||||||
import EmberObject from "@ember/object";
|
import EmberObject from "@ember/object";
|
||||||
import computed from "ember-addons/ember-computed-decorators";
|
import computed from "ember-addons/ember-computed-decorators";
|
||||||
|
@ -39,7 +40,7 @@ const Site = RestModel.extend({
|
||||||
|
|
||||||
let siteFields = this.user_fields;
|
let siteFields = this.user_fields;
|
||||||
|
|
||||||
if (!Ember.isEmpty(siteFields)) {
|
if (!isEmpty(siteFields)) {
|
||||||
return siteFields.map(f => {
|
return siteFields.map(f => {
|
||||||
let value = fields ? fields[f.id.toString()] : null;
|
let value = fields ? fields[f.id.toString()] : null;
|
||||||
value = value || "—".htmlSafe();
|
value = value || "—".htmlSafe();
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { NotificationLevels } from "discourse/lib/notification-levels";
|
import { NotificationLevels } from "discourse/lib/notification-levels";
|
||||||
import {
|
import {
|
||||||
default as computed,
|
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.
|
// If we have a cached topic list, we can update it from our tracking information.
|
||||||
updateTopics(topics) {
|
updateTopics(topics) {
|
||||||
if (Ember.isEmpty(topics)) {
|
if (isEmpty(topics)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { gt, equal, or } from "@ember/object/computed";
|
import { gt, equal, or } from "@ember/object/computed";
|
||||||
import EmberObject from "@ember/object";
|
import EmberObject from "@ember/object";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
|
@ -86,7 +87,7 @@ const User = RestModel.extend({
|
||||||
|
|
||||||
@computed("username", "name")
|
@computed("username", "name")
|
||||||
displayName(username, name) {
|
displayName(username, name) {
|
||||||
if (Discourse.SiteSettings.enable_names && !Ember.isEmpty(name)) {
|
if (Discourse.SiteSettings.enable_names && !isEmpty(name)) {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
return username;
|
return username;
|
||||||
|
@ -95,7 +96,7 @@ const User = RestModel.extend({
|
||||||
@computed("profile_background_upload_url")
|
@computed("profile_background_upload_url")
|
||||||
profileBackgroundUrl(bgUrl) {
|
profileBackgroundUrl(bgUrl) {
|
||||||
if (
|
if (
|
||||||
Ember.isEmpty(bgUrl) ||
|
isEmpty(bgUrl) ||
|
||||||
!Discourse.SiteSettings.allow_profile_backgrounds
|
!Discourse.SiteSettings.allow_profile_backgrounds
|
||||||
) {
|
) {
|
||||||
return "".htmlSafe();
|
return "".htmlSafe();
|
||||||
|
@ -515,7 +516,7 @@ const User = RestModel.extend({
|
||||||
// The user's stat count, excluding PMs.
|
// The user's stat count, excluding PMs.
|
||||||
@computed("statsExcludingPms.@each.count")
|
@computed("statsExcludingPms.@each.count")
|
||||||
statsCountNonPM() {
|
statsCountNonPM() {
|
||||||
if (Ember.isEmpty(this.statsExcludingPms)) return 0;
|
if (isEmpty(this.statsExcludingPms)) return 0;
|
||||||
let count = 0;
|
let count = 0;
|
||||||
this.statsExcludingPms.forEach(val => {
|
this.statsExcludingPms.forEach(val => {
|
||||||
if (this.inAllStream(val)) {
|
if (this.inAllStream(val)) {
|
||||||
|
@ -528,7 +529,7 @@ const User = RestModel.extend({
|
||||||
// The user's stats, excluding PMs.
|
// The user's stats, excluding PMs.
|
||||||
@computed("stats.@each.isPM")
|
@computed("stats.@each.isPM")
|
||||||
statsExcludingPms() {
|
statsExcludingPms() {
|
||||||
if (Ember.isEmpty(this.stats)) return [];
|
if (isEmpty(this.stats)) return [];
|
||||||
return this.stats.rejectBy("isPM");
|
return this.stats.rejectBy("isPM");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -538,7 +539,7 @@ const User = RestModel.extend({
|
||||||
return PreloadStore.getAndRemove(`user_${user.get("username")}`, () => {
|
return PreloadStore.getAndRemove(`user_${user.get("username")}`, () => {
|
||||||
return ajax(userPath(`${user.get("username")}.json`), { data: options });
|
return ajax(userPath(`${user.get("username")}.json`), { data: options });
|
||||||
}).then(json => {
|
}).then(json => {
|
||||||
if (!Ember.isEmpty(json.user.stats)) {
|
if (!isEmpty(json.user.stats)) {
|
||||||
json.user.stats = Discourse.User.groupStats(
|
json.user.stats = Discourse.User.groupStats(
|
||||||
json.user.stats.map(s => {
|
json.user.stats.map(s => {
|
||||||
if (s.count) s.count = parseInt(s.count, 10);
|
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 = [];
|
const groups = [];
|
||||||
|
|
||||||
for (let i = 0; i < json.user.groups.length; i++) {
|
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);
|
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 = {};
|
const userBadgesMap = {};
|
||||||
UserBadge.createFromJson(json).forEach(userBadge => {
|
UserBadge.createFromJson(json).forEach(userBadge => {
|
||||||
userBadgesMap[userBadge.get("id")] = userBadge;
|
userBadgesMap[userBadge.get("id")] = userBadge;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { scheduleOnce } from "@ember/runloop";
|
import { scheduleOnce } from "@ember/runloop";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import DiscourseURL from "discourse/lib/url";
|
import DiscourseURL from "discourse/lib/url";
|
||||||
|
@ -68,7 +69,7 @@ export default DiscourseRoute.extend({
|
||||||
}
|
}
|
||||||
DiscourseURL.jumpToPost(closest, opts);
|
DiscourseURL.jumpToPost(closest, opts);
|
||||||
|
|
||||||
if (!Ember.isEmpty(topic.draft)) {
|
if (!isEmpty(topic.draft)) {
|
||||||
composerController.open({
|
composerController.open({
|
||||||
draft: Draft.getLocal(topic.draft_key, topic.draft),
|
draft: Draft.getLocal(topic.draft_key, topic.draft),
|
||||||
draftKey: topic.draft_key,
|
draftKey: topic.draft_key,
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { cancel } from "@ember/runloop";
|
import { cancel } from "@ember/runloop";
|
||||||
import { scheduleOnce } from "@ember/runloop";
|
import { scheduleOnce } from "@ember/runloop";
|
||||||
import { later } from "@ember/runloop";
|
import { later } from "@ember/runloop";
|
||||||
|
@ -220,7 +221,7 @@ const TopicRoute = DiscourseRoute.extend({
|
||||||
userFilters = postStream.get("userFilters");
|
userFilters = postStream.get("userFilters");
|
||||||
|
|
||||||
userFilters.clear();
|
userFilters.clear();
|
||||||
if (!Ember.isEmpty(usernames) && usernames !== "undefined") {
|
if (!isEmpty(usernames) && usernames !== "undefined") {
|
||||||
userFilters.addObjects(usernames.split(","));
|
userFilters.addObjects(usernames.split(","));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import EmberObject from "@ember/object";
|
import EmberObject from "@ember/object";
|
||||||
import {
|
import {
|
||||||
default as computed,
|
default as computed,
|
||||||
|
@ -48,7 +49,7 @@ const LogsNotice = EmberObject.extend({
|
||||||
|
|
||||||
@computed("text")
|
@computed("text")
|
||||||
isEmpty(text) {
|
isEmpty(text) {
|
||||||
return Ember.isEmpty(text);
|
return isEmpty(text);
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed("text")
|
@computed("text")
|
||||||
|
@ -62,8 +63,8 @@ const LogsNotice = EmberObject.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed("isEmpty", "isAdmin")
|
@computed("isEmpty", "isAdmin")
|
||||||
hidden(isEmpty, isAdmin) {
|
hidden(thisIsEmpty, isAdmin) {
|
||||||
return !isAdmin || isEmpty;
|
return !isAdmin || thisIsEmpty;
|
||||||
},
|
},
|
||||||
|
|
||||||
@observes("text")
|
@observes("text")
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { wantsNewWindow } from "discourse/lib/intercept-click";
|
import { wantsNewWindow } from "discourse/lib/intercept-click";
|
||||||
import RawHtml from "discourse/widgets/raw-html";
|
import RawHtml from "discourse/widgets/raw-html";
|
||||||
import { createWidget } from "discourse/widgets/widget";
|
import { createWidget } from "discourse/widgets/widget";
|
||||||
|
@ -74,7 +75,7 @@ export const DefaultNotificationItem = createWidget(
|
||||||
|
|
||||||
const description = data.topic_title;
|
const description = data.topic_title;
|
||||||
|
|
||||||
return Ember.isEmpty(description) ? "" : escapeExpression(description);
|
return isEmpty(description) ? "" : escapeExpression(description);
|
||||||
},
|
},
|
||||||
|
|
||||||
text(notificationName, data) {
|
text(notificationName, data) {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { createWidgetFrom } from "discourse/widgets/widget";
|
import { createWidgetFrom } from "discourse/widgets/widget";
|
||||||
import { DefaultNotificationItem } from "discourse/widgets/default-notification-item";
|
import { DefaultNotificationItem } from "discourse/widgets/default-notification-item";
|
||||||
import { escapeExpression } from "discourse/lib/utilities";
|
import { escapeExpression } from "discourse/lib/utilities";
|
||||||
|
@ -25,7 +26,7 @@ createWidgetFrom(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
return Ember.isEmpty(description) ? "" : escapeExpression(description);
|
return isEmpty(description) ? "" : escapeExpression(description);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import ComboBoxSelectBoxHeaderComponent from "select-kit/components/combo-box/combo-box-header";
|
import ComboBoxSelectBoxHeaderComponent from "select-kit/components/combo-box/combo-box-header";
|
||||||
import computed from "ember-addons/ember-computed-decorators";
|
import computed from "ember-addons/ember-computed-decorators";
|
||||||
import Category from "discourse/models/category";
|
import Category from "discourse/models/category";
|
||||||
|
@ -12,7 +13,7 @@ export default ComboBoxSelectBoxHeaderComponent.extend({
|
||||||
|
|
||||||
@computed("computedContent.value", "computedContent.name")
|
@computed("computedContent.value", "computedContent.name")
|
||||||
category(value, name) {
|
category(value, name) {
|
||||||
if (Ember.isEmpty(value)) {
|
if (isEmpty(value)) {
|
||||||
const uncat = Category.findUncategorized();
|
const uncat = Category.findUncategorized();
|
||||||
if (uncat && uncat.get("name") === name) {
|
if (uncat && uncat.get("name") === name) {
|
||||||
return uncat;
|
return uncat;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import SelectKitRowComponent from "select-kit/components/select-kit/select-kit-row";
|
import SelectKitRowComponent from "select-kit/components/select-kit/select-kit-row";
|
||||||
import computed from "ember-addons/ember-computed-decorators";
|
import computed from "ember-addons/ember-computed-decorators";
|
||||||
import Category from "discourse/models/category";
|
import Category from "discourse/models/category";
|
||||||
|
@ -27,7 +28,7 @@ export default SelectKitRowComponent.extend({
|
||||||
|
|
||||||
@computed("computedContent.value", "computedContent.name")
|
@computed("computedContent.value", "computedContent.name")
|
||||||
category(value, name) {
|
category(value, name) {
|
||||||
if (Ember.isEmpty(value)) {
|
if (isEmpty(value)) {
|
||||||
const uncat = Category.findUncategorized();
|
const uncat = Category.findUncategorized();
|
||||||
if (uncat && uncat.get("name") === name) {
|
if (uncat && uncat.get("name") === name) {
|
||||||
return uncat;
|
return uncat;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import ComboBoxComponent from "select-kit/components/combo-box";
|
import ComboBoxComponent from "select-kit/components/combo-box";
|
||||||
import { CLOSE_STATUS_TYPE } from "discourse/controllers/edit-topic-timer";
|
import { CLOSE_STATUS_TYPE } from "discourse/controllers/edit-topic-timer";
|
||||||
import DatetimeMixin from "select-kit/components/future-date-input-selector/mixin";
|
import DatetimeMixin from "select-kit/components/future-date-input-selector/mixin";
|
||||||
|
@ -239,7 +240,7 @@ export default ComboBoxComponent.extend(DatetimeMixin, {
|
||||||
let input = null;
|
let input = null;
|
||||||
const { time } = this._updateAt(value);
|
const { time } = this._updateAt(value);
|
||||||
|
|
||||||
if (time && !Ember.isEmpty(value)) {
|
if (time && !isEmpty(value)) {
|
||||||
input = time.locale("en").format(FORMAT);
|
input = time.locale("en").format(FORMAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { throttle } from "@ember/runloop";
|
import { throttle } from "@ember/runloop";
|
||||||
import { schedule } from "@ember/runloop";
|
import { schedule } from "@ember/runloop";
|
||||||
import { on } from "ember-addons/ember-computed-decorators";
|
import { on } from "ember-addons/ember-computed-decorators";
|
||||||
|
@ -114,14 +115,14 @@ export default Mixin.create({
|
||||||
this.unfocus(event);
|
this.unfocus(event);
|
||||||
}
|
}
|
||||||
if (keyCode === this.keys.TAB && !event.shiftKey) this.tabFromHeader(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);
|
this.backspaceFromHeader(event);
|
||||||
if (keyCode === this.keys.ESC) this.escapeFromHeader(event);
|
if (keyCode === this.keys.ESC) this.escapeFromHeader(event);
|
||||||
if (keyCode === this.keys.ENTER) this.enterFromHeader(event);
|
if (keyCode === this.keys.ENTER) this.enterFromHeader(event);
|
||||||
if ([this.keys.UP, this.keys.DOWN].includes(keyCode))
|
if ([this.keys.UP, this.keys.DOWN].includes(keyCode))
|
||||||
this.upAndDownFromHeader(event);
|
this.upAndDownFromHeader(event);
|
||||||
if (
|
if (
|
||||||
Ember.isEmpty(this.filter) &&
|
isEmpty(this.filter) &&
|
||||||
[this.keys.LEFT, this.keys.RIGHT].includes(keyCode)
|
[this.keys.LEFT, this.keys.RIGHT].includes(keyCode)
|
||||||
) {
|
) {
|
||||||
this.leftAndRightFromHeader(event);
|
this.leftAndRightFromHeader(event);
|
||||||
|
@ -154,7 +155,7 @@ export default Mixin.create({
|
||||||
const keyCode = event.keyCode || event.which;
|
const keyCode = event.keyCode || event.which;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
Ember.isEmpty(this.filter) &&
|
isEmpty(this.filter) &&
|
||||||
keyCode === this.keys.BACKSPACE &&
|
keyCode === this.keys.BACKSPACE &&
|
||||||
typeof this.didPressBackspaceFromFilter === "function"
|
typeof this.didPressBackspaceFromFilter === "function"
|
||||||
) {
|
) {
|
||||||
|
@ -171,7 +172,7 @@ export default Mixin.create({
|
||||||
this.upAndDownFromFilter(event);
|
this.upAndDownFromFilter(event);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
Ember.isEmpty(this.filter) &&
|
isEmpty(this.filter) &&
|
||||||
[this.keys.LEFT, this.keys.RIGHT].includes(keyCode)
|
[this.keys.LEFT, this.keys.RIGHT].includes(keyCode)
|
||||||
) {
|
) {
|
||||||
this.leftAndRightFromFilter(event);
|
this.leftAndRightFromFilter(event);
|
||||||
|
@ -197,7 +198,7 @@ export default Mixin.create({
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Ember.isEmpty(this.filter)) {
|
if (isEmpty(this.filter)) {
|
||||||
this.close(event);
|
this.close(event);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -285,7 +286,7 @@ export default Mixin.create({
|
||||||
|
|
||||||
if (!this.selection || !this.selection.length) return;
|
if (!this.selection || !this.selection.length) return;
|
||||||
|
|
||||||
if (!Ember.isEmpty(this.filter)) {
|
if (!isEmpty(this.filter)) {
|
||||||
this.clearHighlightSelection();
|
this.clearHighlightSelection();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -336,7 +337,7 @@ export default Mixin.create({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Ember.isEmpty(this.selection)) return;
|
if (isEmpty(this.selection)) return;
|
||||||
|
|
||||||
const keyCode = event.keyCode || event.which;
|
const keyCode = event.keyCode || event.which;
|
||||||
|
|
||||||
|
|
|
@ -442,6 +442,7 @@ module ApplicationHelper
|
||||||
ids = theme_ids
|
ids = theme_ids
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Rails.logger.info "0 >>>>>> #{name}"
|
||||||
Stylesheet::Manager.stylesheet_link_tag(name, 'all', ids)
|
Stylesheet::Manager.stylesheet_link_tag(name, 'all', ids)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { schedule } from "@ember/runloop";
|
import { schedule } from "@ember/runloop";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
/* global Pikaday:true */
|
/* global Pikaday:true */
|
||||||
|
@ -358,7 +359,7 @@ export default Component.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
_setTimeIfValid(time, key) {
|
_setTimeIfValid(time, key) {
|
||||||
if (Ember.isEmpty(time)) {
|
if (isEmpty(time)) {
|
||||||
this.set(key, null);
|
this.set(key, null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { run } from "@ember/runloop";
|
import { run } from "@ember/runloop";
|
||||||
import { later } from "@ember/runloop";
|
import { later } from "@ember/runloop";
|
||||||
/* global QUnit, resetSite */
|
/* global QUnit, resetSite */
|
||||||
|
@ -182,7 +183,7 @@ QUnit.assert.not = function(actual, message) {
|
||||||
|
|
||||||
QUnit.assert.blank = function(actual, message) {
|
QUnit.assert.blank = function(actual, message) {
|
||||||
this.pushResult({
|
this.pushResult({
|
||||||
result: Ember.isEmpty(actual),
|
result: isEmpty(actual),
|
||||||
actual,
|
actual,
|
||||||
message
|
message
|
||||||
});
|
});
|
||||||
|
@ -190,7 +191,7 @@ QUnit.assert.blank = function(actual, message) {
|
||||||
|
|
||||||
QUnit.assert.present = function(actual, message) {
|
QUnit.assert.present = function(actual, message) {
|
||||||
this.pushResult({
|
this.pushResult({
|
||||||
result: !Ember.isEmpty(actual),
|
result: !isEmpty(actual),
|
||||||
actual,
|
actual,
|
||||||
message
|
message
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue