DEV: Import every instance of Ember.computed function (#8267)

* DEV: Import every instance of Ember.computed function

* export default for Ember.computed
This commit is contained in:
Mark VanLandingham 2019-10-30 15:28:29 -05:00 committed by GitHub
parent 790a7e2095
commit 2ae21e9c35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
153 changed files with 621 additions and 434 deletions

View File

@ -1,8 +1,9 @@
import { match } from "@ember/object/computed";
import Component from "@ember/component"; import Component from "@ember/component";
export default Component.extend({ export default Component.extend({
allTime: true, allTime: true,
tagName: "tr", tagName: "tr",
reverseColors: Ember.computed.match( reverseColors: match(
"report.type", "report.type",
/^(time_to_first_response|topics_with_no_response)$/ /^(time_to_first_response|topics_with_no_response)$/
), ),

View File

@ -1,3 +1,4 @@
import { alias } from "@ember/object/computed";
import Component from "@ember/component"; import Component from "@ember/component";
import { setting } from "discourse/lib/computed"; import { setting } from "discourse/lib/computed";
import computed from "ember-addons/ember-computed-decorators"; import computed from "ember-addons/ember-computed-decorators";
@ -6,8 +7,8 @@ export default Component.extend({
classNames: ["admin-report-storage-stats"], classNames: ["admin-report-storage-stats"],
backupLocation: setting("backup_location"), backupLocation: setting("backup_location"),
backupStats: Ember.computed.alias("model.data.backups"), backupStats: alias("model.data.backups"),
uploadStats: Ember.computed.alias("model.data.uploads"), uploadStats: alias("model.data.uploads"),
@computed("backupStats") @computed("backupStats")
showBackupStats(stats) { showBackupStats(stats) {

View File

@ -1,3 +1,4 @@
import { alias } 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";
@ -12,8 +13,8 @@ export default Component.extend({
return label.compute(data, options || {}); return label.compute(data, options || {});
}, },
type: Ember.computed.alias("label.type"), type: alias("label.type"),
property: Ember.computed.alias("label.mainProperty"), property: alias("label.mainProperty"),
formatedValue: Ember.computed.alias("computedLabel.formatedValue"), formatedValue: alias("computedLabel.formatedValue"),
value: Ember.computed.alias("computedLabel.value") value: alias("computedLabel.value")
}); });

View File

@ -1,3 +1,4 @@
import { alias } 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";
@ -8,7 +9,7 @@ export default Component.extend({
classNames: ["admin-report-table"], classNames: ["admin-report-table"],
sortable: false, sortable: false,
sortDirection: 1, sortDirection: 1,
perPage: Ember.computed.alias("options.perPage"), perPage: alias("options.perPage"),
page: 0, page: 0,
@computed("model.computedLabels.length") @computed("model.computedLabels.length")

View File

@ -1,3 +1,4 @@
import { alias, or, and, reads, equal, notEmpty } from "@ember/object/computed";
import EmberObject from "@ember/object"; import EmberObject from "@ember/object";
import { next } from "@ember/runloop"; import { next } from "@ember/runloop";
import Component from "@ember/component"; import Component from "@ember/component";
@ -57,12 +58,12 @@ export default Component.extend({
showHeader: true, showHeader: true,
showTitle: true, showTitle: true,
showFilteringUI: false, showFilteringUI: false,
showDatesOptions: Ember.computed.alias("model.dates_filtering"), showDatesOptions: alias("model.dates_filtering"),
showRefresh: Ember.computed.or( showRefresh: or(
"showDatesOptions", "showDatesOptions",
"model.available_filters.length" "model.available_filters.length"
), ),
shouldDisplayTrend: Ember.computed.and("showTrend", "model.prev_period"), shouldDisplayTrend: and("showTrend", "model.prev_period"),
init() { init() {
this._super(...arguments); this._super(...arguments);
@ -70,8 +71,8 @@ export default Component.extend({
this._reports = []; this._reports = [];
}, },
startDate: Ember.computed.reads("filters.startDate"), startDate: reads("filters.startDate"),
endDate: Ember.computed.reads("filters.endDate"), endDate: reads("filters.endDate"),
didReceiveAttrs() { didReceiveAttrs() {
this._super(...arguments); this._super(...arguments);
@ -83,16 +84,16 @@ export default Component.extend({
} }
}, },
showError: Ember.computed.or( showError: or(
"showTimeoutError", "showTimeoutError",
"showExceptionError", "showExceptionError",
"showNotFoundError" "showNotFoundError"
), ),
showNotFoundError: Ember.computed.equal("model.error", "not_found"), showNotFoundError: equal("model.error", "not_found"),
showTimeoutError: Ember.computed.equal("model.error", "timeout"), showTimeoutError: equal("model.error", "timeout"),
showExceptionError: Ember.computed.equal("model.error", "exception"), showExceptionError: equal("model.error", "exception"),
hasData: Ember.computed.notEmpty("model.data"), hasData: notEmpty("model.data"),
@computed("dataSourceName", "model.type") @computed("dataSourceName", "model.type")
dasherizedDataSourceName(dataSourceName, type) { dasherizedDataSourceName(dataSourceName, type) {

View File

@ -1,3 +1,4 @@
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";
import UserField from "admin/models/user-field"; import UserField from "admin/models/user-field";
@ -12,7 +13,7 @@ import {
} from "ember-addons/ember-computed-decorators"; } from "ember-addons/ember-computed-decorators";
export default Component.extend(bufferedProperty("userField"), { export default Component.extend(bufferedProperty("userField"), {
editing: Ember.computed.empty("userField.id"), editing: empty("userField.id"),
classNameBindings: [":user-field"], classNameBindings: [":user-field"],
cantMoveUp: propertyEqual("userField", "firstField"), cantMoveUp: propertyEqual("userField", "firstField"),

View File

@ -1,9 +1,10 @@
import { alias } 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";
export default Component.extend({ export default Component.extend({
classNames: ["hook-event"], classNames: ["hook-event"],
typeName: Ember.computed.alias("type.name"), typeName: alias("type.name"),
@computed("typeName") @computed("typeName")
name(typeName) { name(typeName) {

View File

@ -1,8 +1,9 @@
import { reads } 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";
export default Component.extend({ export default Component.extend({
editorId: Ember.computed.reads("fieldName"), editorId: reads("fieldName"),
@computed("fieldName") @computed("fieldName")
currentEditorMode(fieldName) { currentEditorMode(fieldName) {

View File

@ -1,3 +1,4 @@
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";
import { bufferedProperty } from "discourse/mixins/buffered-content"; import { bufferedProperty } from "discourse/mixins/buffered-content";
@ -10,7 +11,7 @@ export default Component.extend(bufferedProperty("host"), {
tagName: "tr", tagName: "tr",
categoryId: null, categoryId: null,
editing: Ember.computed.or("host.isNew", "editToggled"), editing: or("host.isNew", "editToggled"),
@on("didInsertElement") @on("didInsertElement")
@observes("editing") @observes("editing")

View File

@ -1,3 +1,4 @@
import { equal } from "@ember/object/computed";
import { scheduleOnce } from "@ember/runloop"; import { scheduleOnce } 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";
@ -16,7 +17,7 @@ export default Component.extend({
}); });
}, },
editing: Ember.computed.equal("postAction", "edit"), editing: equal("postAction", "edit"),
actions: { actions: {
penaltyChanged() { penaltyChanged() {

View File

@ -1,10 +1,11 @@
import { or } 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";
export default Component.extend({ export default Component.extend({
classNames: ["controls"], classNames: ["controls"],
buttonDisabled: Ember.computed.or("model.isSaving", "saveDisabled"), buttonDisabled: or("model.isSaving", "saveDisabled"),
@computed("model.isSaving") @computed("model.isSaving")
savingText(saving) { savingText(saving) {

View File

@ -1,10 +1,11 @@
import { alias } from "@ember/object/computed";
import Component from "@ember/component"; import Component from "@ember/component";
import UploadMixin from "discourse/mixins/upload"; import UploadMixin from "discourse/mixins/upload";
export default Component.extend(UploadMixin, { export default Component.extend(UploadMixin, {
type: "csv", type: "csv",
uploadUrl: "/tags/upload", uploadUrl: "/tags/upload",
addDisabled: Ember.computed.alias("uploading"), addDisabled: alias("uploading"),
elementId: "tag-uploader", elementId: "tag-uploader",
validateUploadedFilesOptions() { validateUploadedFilesOptions() {

View File

@ -1,12 +1,13 @@
import { alias } from "@ember/object/computed";
import Component from "@ember/component"; import Component from "@ember/component";
import BufferedContent from "discourse/mixins/buffered-content"; import BufferedContent from "discourse/mixins/buffered-content";
import SettingComponent from "admin/mixins/setting-component"; import SettingComponent from "admin/mixins/setting-component";
export default Component.extend(BufferedContent, SettingComponent, { export default Component.extend(BufferedContent, SettingComponent, {
layoutName: "admin/templates/components/site-setting", layoutName: "admin/templates/components/site-setting",
setting: Ember.computed.alias("translation"), setting: alias("translation"),
type: "string", type: "string",
settingName: Ember.computed.alias("translation.key"), settingName: alias("translation.key"),
_save() { _save() {
return this.model.saveTranslation( return this.model.saveTranslation(

View File

@ -1,3 +1,4 @@
import { gt, and } from "@ember/object/computed";
import { schedule } from "@ember/runloop"; import { schedule } from "@ember/runloop";
import Component from "@ember/component"; import Component from "@ember/component";
import { import {
@ -13,9 +14,9 @@ export default Component.extend({
childrenExpanded: false, childrenExpanded: false,
classNames: ["themes-list-item"], classNames: ["themes-list-item"],
classNameBindings: ["theme.selected:selected"], classNameBindings: ["theme.selected:selected"],
hasComponents: Ember.computed.gt("children.length", 0), hasComponents: gt("children.length", 0),
displayComponents: Ember.computed.and("hasComponents", "theme.isActive"), displayComponents: and("hasComponents", "theme.isActive"),
displayHasMore: Ember.computed.gt("theme.childThemes.length", MAX_COMPONENTS), displayHasMore: gt("theme.childThemes.length", MAX_COMPONENTS),
click(e) { click(e) {
if (!$(e.target).hasClass("others-count")) { if (!$(e.target).hasClass("others-count")) {

View File

@ -1,3 +1,4 @@
import { gt, equal } from "@ember/object/computed";
import Component from "@ember/component"; import Component from "@ember/component";
import { THEMES, COMPONENTS } from "admin/models/theme"; import { THEMES, COMPONENTS } from "admin/models/theme";
import { default as computed } from "ember-addons/ember-computed-decorators"; import { default as computed } from "ember-addons/ember-computed-decorators";
@ -8,12 +9,12 @@ export default Component.extend({
classNames: ["themes-list"], classNames: ["themes-list"],
hasThemes: Ember.computed.gt("themesList.length", 0), hasThemes: gt("themesList.length", 0),
hasActiveThemes: Ember.computed.gt("activeThemes.length", 0), hasActiveThemes: gt("activeThemes.length", 0),
hasInactiveThemes: Ember.computed.gt("inactiveThemes.length", 0), hasInactiveThemes: gt("inactiveThemes.length", 0),
themesTabActive: Ember.computed.equal("currentTab", THEMES), themesTabActive: equal("currentTab", THEMES),
componentsTabActive: Ember.computed.equal("currentTab", COMPONENTS), componentsTabActive: equal("currentTab", COMPONENTS),
@computed("themes", "components", "currentTab") @computed("themes", "components", "currentTab")
themesList(themes, components) { themesList(themes, components) {

View File

@ -1,3 +1,4 @@
import { empty, alias } from "@ember/object/computed";
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";
import computed from "ember-addons/ember-computed-decorators"; import computed from "ember-addons/ember-computed-decorators";
@ -5,14 +6,14 @@ import computed from "ember-addons/ember-computed-decorators";
export default Component.extend({ export default Component.extend({
classNameBindings: [":value-list"], classNameBindings: [":value-list"],
inputInvalid: Ember.computed.empty("newValue"), inputInvalid: empty("newValue"),
inputDelimiter: null, inputDelimiter: null,
inputType: null, inputType: null,
newValue: "", newValue: "",
collection: null, collection: null,
values: null, values: null,
noneKey: Ember.computed.alias("addKey"), noneKey: alias("addKey"),
@on("didReceiveAttrs") @on("didReceiveAttrs")
_setupCollection() { _setupCollection() {

View File

@ -1,3 +1,4 @@
import { alias } 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";
import UploadMixin from "discourse/mixins/upload"; import UploadMixin from "discourse/mixins/upload";
@ -6,7 +7,7 @@ export default Component.extend(UploadMixin, {
type: "txt", type: "txt",
classNames: "watched-words-uploader", classNames: "watched-words-uploader",
uploadUrl: "/admin/logs/watched_words/upload", uploadUrl: "/admin/logs/watched_words/upload",
addDisabled: Ember.computed.alias("uploading"), addDisabled: alias("uploading"),
validateUploadedFilesOptions() { validateUploadedFilesOptions() {
return { skipValidation: true }; return { skipValidation: true };

View File

@ -1,3 +1,4 @@
import { alias, equal } from "@ember/object/computed";
import { inject } from "@ember/controller"; import { inject } from "@ember/controller";
import Controller from "@ember/controller"; import Controller from "@ember/controller";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
@ -6,10 +7,10 @@ import { setting, i18n } from "discourse/lib/computed";
export default Controller.extend({ export default Controller.extend({
adminBackups: inject(), adminBackups: inject(),
status: Ember.computed.alias("adminBackups.model"), status: alias("adminBackups.model"),
uploadLabel: i18n("admin.backups.upload.label"), uploadLabel: i18n("admin.backups.upload.label"),
backupLocation: setting("backup_location"), backupLocation: setting("backup_location"),
localBackupStorage: Ember.computed.equal("backupLocation", "local"), localBackupStorage: equal("backupLocation", "local"),
@computed("status.allowRestore", "status.isOperationRunning") @computed("status.allowRestore", "status.isOperationRunning")
restoreTitle(allowRestore, isOperationRunning) { restoreTitle(allowRestore, isOperationRunning) {

View File

@ -1,8 +1,9 @@
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";
export default Controller.extend({ export default Controller.extend({
adminBackups: inject(), adminBackups: inject(),
status: Ember.computed.alias("adminBackups.model"), status: alias("adminBackups.model"),
init() { init() {
this._super(...arguments); this._super(...arguments);

View File

@ -1,10 +1,11 @@
import { not, and } from "@ember/object/computed";
import Controller from "@ember/controller"; import Controller from "@ember/controller";
export default Controller.extend({ export default Controller.extend({
noOperationIsRunning: Ember.computed.not("model.isOperationRunning"), noOperationIsRunning: not("model.isOperationRunning"),
rollbackEnabled: Ember.computed.and( rollbackEnabled: and(
"model.canRollback", "model.canRollback",
"model.restoreEnabled", "model.restoreEnabled",
"noOperationIsRunning" "noOperationIsRunning"
), ),
rollbackDisabled: Ember.computed.not("rollbackEnabled") rollbackDisabled: not("rollbackEnabled")
}); });

View File

@ -1,3 +1,4 @@
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";
import { popupAjaxError } from "discourse/lib/ajax-error"; import { popupAjaxError } from "discourse/lib/ajax-error";
@ -10,14 +11,14 @@ export default Controller.extend(bufferedProperty("model"), {
saving: false, saving: false,
savingStatus: "", savingStatus: "",
badgeTypes: Ember.computed.alias("adminBadges.badgeTypes"), badgeTypes: alias("adminBadges.badgeTypes"),
badgeGroupings: Ember.computed.alias("adminBadges.badgeGroupings"), badgeGroupings: alias("adminBadges.badgeGroupings"),
badgeTriggers: Ember.computed.alias("adminBadges.badgeTriggers"), badgeTriggers: alias("adminBadges.badgeTriggers"),
protectedSystemFields: Ember.computed.alias( protectedSystemFields: alias(
"adminBadges.protectedSystemFields" "adminBadges.protectedSystemFields"
), ),
readOnly: Ember.computed.alias("buffered.system"), readOnly: alias("buffered.system"),
showDisplayName: propertyNotEqual("name", "displayName"), showDisplayName: propertyNotEqual("name", "displayName"),
@computed("model.query", "buffered.query") @computed("model.query", "buffered.query")

View File

@ -1,7 +1,8 @@
import { sort } from "@ember/object/computed";
import Controller from "@ember/controller"; import Controller from "@ember/controller";
export default Controller.extend({ export default Controller.extend({
emailTemplates: null, emailTemplates: null,
sortedTemplates: Ember.computed.sort("emailTemplates", "titleSorting"), sortedTemplates: sort("emailTemplates", "titleSorting"),
init() { init() {
this._super(...arguments); this._super(...arguments);

View File

@ -1,3 +1,4 @@
import { not } from "@ember/object/computed";
import Controller from "@ember/controller"; import Controller from "@ember/controller";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
import { bufferedProperty } from "discourse/mixins/buffered-content"; import { bufferedProperty } from "discourse/mixins/buffered-content";
@ -7,7 +8,7 @@ export default Controller.extend(bufferedProperty("model"), {
saved: false, saved: false,
isSaving: false, isSaving: false,
saveDisabled: propertyEqual("model.robots_txt", "buffered.robots_txt"), saveDisabled: propertyEqual("model.robots_txt", "buffered.robots_txt"),
resetDisbaled: Ember.computed.not("model.overridden"), resetDisbaled: not("model.overridden"),
actions: { actions: {
save() { save() {

View File

@ -1,3 +1,4 @@
import { empty, notEmpty, match } 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";
import { url } from "discourse/lib/computed"; import { url } from "discourse/lib/computed";
@ -11,7 +12,7 @@ const THEME_UPLOAD_VAR = 2;
export default Controller.extend({ export default Controller.extend({
downloadUrl: url("model.id", "/admin/customize/themes/%@/export"), downloadUrl: url("model.id", "/admin/customize/themes/%@/export"),
previewUrl: url("model.id", "/admin/themes/%@/preview"), previewUrl: url("model.id", "/admin/themes/%@/preview"),
addButtonDisabled: Ember.computed.empty("selectedChildThemeId"), addButtonDisabled: empty("selectedChildThemeId"),
editRouteName: "adminCustomizeThemes.edit", editRouteName: "adminCustomizeThemes.edit",
@computed("model.editedFields") @computed("model.editedFields")
@ -80,14 +81,14 @@ export default Controller.extend({
return settings.map(setting => ThemeSettings.create(setting)); return settings.map(setting => ThemeSettings.create(setting));
}, },
hasSettings: Ember.computed.notEmpty("settings"), hasSettings: notEmpty("settings"),
@computed("model.translations") @computed("model.translations")
translations(translations) { translations(translations) {
return translations.map(setting => ThemeSettings.create(setting)); return translations.map(setting => ThemeSettings.create(setting));
}, },
hasTranslations: Ember.computed.notEmpty("translations"), hasTranslations: notEmpty("translations"),
@computed("model.remoteError", "updatingRemote") @computed("model.remoteError", "updatingRemote")
showRemoteError(errorMessage, updating) { showRemoteError(errorMessage, updating) {
@ -148,7 +149,7 @@ export default Controller.extend({
"scss" "scss"
); );
}, },
sourceIsHttp: Ember.computed.match( sourceIsHttp: match(
"model.remote_theme.remote_url", "model.remote_theme.remote_url",
/^http(s)?:\/\// /^http(s)?:\/\//
), ),

View File

@ -1,3 +1,4 @@
import { empty } from "@ember/object/computed";
import Controller from "@ember/controller"; import Controller from "@ember/controller";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
export default Controller.extend({ export default Controller.extend({
@ -6,7 +7,7 @@ export default Controller.extend({
@property sendTestEmailDisabled @property sendTestEmailDisabled
**/ **/
sendTestEmailDisabled: Ember.computed.empty("testEmailAddress"), sendTestEmailDisabled: empty("testEmailAddress"),
/** /**
Clears the 'sentTestEmail' property on successful send. Clears the 'sentTestEmail' property on successful send.

View File

@ -1,3 +1,4 @@
import { empty, or, notEmpty } from "@ember/object/computed";
import Controller from "@ember/controller"; import Controller from "@ember/controller";
import EmailPreview from "admin/models/email-preview"; import EmailPreview from "admin/models/email-preview";
import { popupAjaxError } from "discourse/lib/ajax-error"; import { popupAjaxError } from "discourse/lib/ajax-error";
@ -6,10 +7,10 @@ export default Controller.extend({
username: null, username: null,
lastSeen: null, lastSeen: null,
emailEmpty: Ember.computed.empty("email"), emailEmpty: empty("email"),
sendEmailDisabled: Ember.computed.or("emailEmpty", "sendingEmail"), sendEmailDisabled: or("emailEmpty", "sendingEmail"),
showSendEmailForm: Ember.computed.notEmpty("model.html_content"), showSendEmailForm: notEmpty("model.html_content"),
htmlEmpty: Ember.computed.empty("model.html_content"), htmlEmpty: empty("model.html_content"),
actions: { actions: {
refresh() { refresh() {

View File

@ -1,8 +1,9 @@
import { sort } from "@ember/object/computed";
import EmberObject from "@ember/object"; import EmberObject from "@ember/object";
import Controller from "@ember/controller"; import Controller from "@ember/controller";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
export default Controller.extend({ export default Controller.extend({
sortedEmojis: Ember.computed.sort("model", "emojiSorting"), sortedEmojis: sort("model", "emojiSorting"),
init() { init() {
this._super(...arguments); this._super(...arguments);

View File

@ -1,3 +1,4 @@
import { gt } from "@ember/object/computed";
import EmberObject from "@ember/object"; import EmberObject from "@ember/object";
import { scheduleOnce } from "@ember/runloop"; import { scheduleOnce } from "@ember/runloop";
import Controller from "@ember/controller"; import Controller from "@ember/controller";
@ -11,7 +12,7 @@ import {
export default Controller.extend({ export default Controller.extend({
model: null, model: null,
filters: null, filters: null,
filtersExists: Ember.computed.gt("filterCount", 0), filtersExists: gt("filterCount", 0),
userHistoryActions: null, userHistoryActions: null,
@computed("filters.action_name") @computed("filters.action_name")

View File

@ -1,9 +1,10 @@
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";
export default Controller.extend({ export default Controller.extend({
filter: null, filter: null,
allSiteSettings: Ember.computed.alias("model"), allSiteSettings: alias("model"),
visibleSiteSettings: null, visibleSiteSettings: null,
onlyOverridden: false, onlyOverridden: false,

View File

@ -1,3 +1,4 @@
import { alias, sort } from "@ember/object/computed";
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";
@ -7,10 +8,10 @@ import computed from "ember-addons/ember-computed-decorators";
export default Controller.extend(GrantBadgeController, { export default Controller.extend(GrantBadgeController, {
adminUser: inject(), adminUser: inject(),
user: Ember.computed.alias("adminUser.model"), user: alias("adminUser.model"),
userBadges: Ember.computed.alias("model"), userBadges: alias("model"),
allBadges: Ember.computed.alias("badges"), allBadges: alias("badges"),
sortedBadges: Ember.computed.sort("model", "badgeSortOrder"), sortedBadges: sort("model", "badgeSortOrder"),
init() { init() {
this._super(...arguments); this._super(...arguments);

View File

@ -1,3 +1,4 @@
import { gte, sort } from "@ember/object/computed";
import Controller from "@ember/controller"; import Controller from "@ember/controller";
import { popupAjaxError } from "discourse/lib/ajax-error"; import { popupAjaxError } from "discourse/lib/ajax-error";
@ -5,8 +6,8 @@ const MAX_FIELDS = 20;
export default Controller.extend({ export default Controller.extend({
fieldTypes: null, fieldTypes: null,
createDisabled: Ember.computed.gte("model.length", MAX_FIELDS), createDisabled: gte("model.length", MAX_FIELDS),
sortedFields: Ember.computed.sort("model", "fieldSortOrder"), sortedFields: sort("model", "fieldSortOrder"),
init() { init() {
this._super(...arguments); this._super(...arguments);

View File

@ -1,3 +1,4 @@
import { notEmpty, and } from "@ember/object/computed";
import { inject as service } from "@ember/service"; import { inject as service } from "@ember/service";
import Controller from "@ember/controller"; import Controller from "@ember/controller";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
@ -16,7 +17,7 @@ export default Controller.extend(CanCheckEmails, {
userTitleValue: null, userTitleValue: null,
showBadges: setting("enable_badges"), showBadges: setting("enable_badges"),
hasLockedTrustLevel: Ember.computed.notEmpty( hasLockedTrustLevel: notEmpty(
"model.manual_locked_trust_level" "model.manual_locked_trust_level"
), ),
@ -25,7 +26,7 @@ export default Controller.extend(CanCheckEmails, {
"model.primary_group_id" "model.primary_group_id"
), ),
canDisableSecondFactor: Ember.computed.and( canDisableSecondFactor: and(
"model.second_factor_enabled", "model.second_factor_enabled",
"model.can_disable_second_factor" "model.can_disable_second_factor"
), ),

View File

@ -1,3 +1,4 @@
import { or } from "@ember/object/computed";
import { schedule } from "@ember/runloop"; import { schedule } from "@ember/runloop";
import { inject } from "@ember/controller"; import { inject } from "@ember/controller";
import Controller from "@ember/controller"; import Controller from "@ember/controller";
@ -10,7 +11,7 @@ import showModal from "discourse/lib/show-modal";
export default Controller.extend({ export default Controller.extend({
actionNameKey: null, actionNameKey: null,
adminWatchedWords: inject(), adminWatchedWords: inject(),
showWordsList: Ember.computed.or( showWordsList: or(
"adminWatchedWords.filtered", "adminWatchedWords.filtered",
"adminWatchedWords.showWords" "adminWatchedWords.showWords"
), ),

View File

@ -1,3 +1,4 @@
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";
import debounce from "discourse/lib/debounce"; import debounce from "discourse/lib/debounce";
@ -6,7 +7,7 @@ export default Controller.extend({
filter: null, filter: null,
filtered: false, filtered: false,
showWords: false, showWords: false,
disableShowWords: Ember.computed.alias("filtered"), disableShowWords: alias("filtered"),
regularExpressions: null, regularExpressions: null,
filterContentNow() { filterContentNow() {

View File

@ -1,3 +1,4 @@
import { alias } from "@ember/object/computed";
import Controller from "@ember/controller"; import Controller from "@ember/controller";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error"; import { popupAjaxError } from "discourse/lib/ajax-error";
@ -5,7 +6,7 @@ import computed from "ember-addons/ember-computed-decorators";
export default Controller.extend({ export default Controller.extend({
pingDisabled: false, pingDisabled: false,
incomingCount: Ember.computed.alias("incomingEventIds.length"), incomingCount: alias("incomingEventIds.length"),
init() { init() {
this._super(...arguments); this._super(...arguments);

View File

@ -1,3 +1,4 @@
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";
import { popupAjaxError } from "discourse/lib/ajax-error"; import { popupAjaxError } from "discourse/lib/ajax-error";
@ -7,9 +8,9 @@ import InputValidation from "discourse/models/input-validation";
export default Controller.extend({ export default Controller.extend({
adminWebHooks: inject(), adminWebHooks: inject(),
eventTypes: Ember.computed.alias("adminWebHooks.eventTypes"), eventTypes: alias("adminWebHooks.eventTypes"),
defaultEventTypes: Ember.computed.alias("adminWebHooks.defaultEventTypes"), defaultEventTypes: alias("adminWebHooks.defaultEventTypes"),
contentTypes: Ember.computed.alias("adminWebHooks.contentTypes"), contentTypes: alias("adminWebHooks.contentTypes"),
@computed @computed
showTagsFilter() { showTagsFilter() {

View File

@ -1,3 +1,4 @@
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";
import ModalFunctionality from "discourse/mixins/modal-functionality"; import ModalFunctionality from "discourse/mixins/modal-functionality";
@ -64,8 +65,8 @@ export default Controller.extend(ModalFunctionality, {
this.set("fileSelected", false); this.set("fileSelected", false);
}, },
enabled: Ember.computed.and("nameValid", "fileSelected"), enabled: and("nameValid", "fileSelected"),
disabled: Ember.computed.not("enabled"), disabled: not("enabled"),
@computed("name", "adminCustomizeThemesShow.model.theme_fields") @computed("name", "adminCustomizeThemesShow.model.theme_fields")
errorMessage(name, themeFields) { errorMessage(name, themeFields) {

View File

@ -1,11 +1,12 @@
import { alias, map } 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";
import { escapeExpression } from "discourse/lib/utilities"; import { escapeExpression } from "discourse/lib/utilities";
export default Controller.extend({ export default Controller.extend({
sample: Ember.computed.alias("model.sample"), sample: alias("model.sample"),
errors: Ember.computed.alias("model.errors"), errors: alias("model.errors"),
count: Ember.computed.alias("model.grant_count"), count: alias("model.grant_count"),
@computed("count", "sample.length") @computed("count", "sample.length")
countWarning(count, sampleLength) { countWarning(count, sampleLength) {
@ -34,7 +35,7 @@ export default Controller.extend({
return output; return output;
}, },
processedSample: Ember.computed.map("model.sample", grant => { processedSample: map("model.sample", grant => {
let i18nKey = "admin.badges.preview.grant.with"; let i18nKey = "admin.badges.preview.grant.with";
const i18nParams = { username: escapeExpression(grant.username) }; const i18nParams = { username: escapeExpression(grant.username) };

View File

@ -1,3 +1,4 @@
import { equal, match, 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";
import ModalFunctionality from "discourse/mixins/modal-functionality"; import ModalFunctionality from "discourse/mixins/modal-functionality";
@ -13,24 +14,24 @@ import { POPULAR_THEMES } from "discourse-common/helpers/popular-themes";
const MIN_NAME_LENGTH = 4; const MIN_NAME_LENGTH = 4;
export default Controller.extend(ModalFunctionality, { export default Controller.extend(ModalFunctionality, {
popular: Ember.computed.equal("selection", "popular"), popular: equal("selection", "popular"),
local: Ember.computed.equal("selection", "local"), local: equal("selection", "local"),
remote: Ember.computed.equal("selection", "remote"), remote: equal("selection", "remote"),
create: Ember.computed.equal("selection", "create"), create: equal("selection", "create"),
selection: "popular", selection: "popular",
adminCustomizeThemes: inject(), adminCustomizeThemes: inject(),
loading: false, loading: false,
keyGenUrl: "/admin/themes/generate_key_pair", keyGenUrl: "/admin/themes/generate_key_pair",
importUrl: "/admin/themes/import", importUrl: "/admin/themes/import",
recordType: "theme", recordType: "theme",
checkPrivate: Ember.computed.match("uploadUrl", /^git/), checkPrivate: match("uploadUrl", /^git/),
localFile: null, localFile: null,
uploadUrl: null, uploadUrl: null,
urlPlaceholder: "https://github.com/discourse/sample_theme", urlPlaceholder: "https://github.com/discourse/sample_theme",
advancedVisible: false, advancedVisible: false,
themesController: inject("adminCustomizeThemes"), themesController: inject("adminCustomizeThemes"),
selectedType: Ember.computed.alias("themesController.currentTab"), selectedType: alias("themesController.currentTab"),
component: Ember.computed.equal("selectedType", COMPONENTS), component: equal("selectedType", COMPONENTS),
init() { init() {
this._super(...arguments); this._super(...arguments);

View File

@ -1,3 +1,4 @@
import { alias, oneWay } from "@ember/object/computed";
import computed from "ember-addons/ember-computed-decorators"; import computed from "ember-addons/ember-computed-decorators";
import { categoryLinkHTML } from "discourse/helpers/category-link"; import { categoryLinkHTML } from "discourse/helpers/category-link";
import Mixin from "@ember/object/mixin"; import Mixin from "@ember/object/mixin";
@ -22,9 +23,9 @@ const AUTO_REFRESH_ON_SAVE = ["logo", "logo_small", "large_icon"];
export default Mixin.create({ export default Mixin.create({
classNameBindings: [":row", ":setting", "overridden", "typeClass"], classNameBindings: [":row", ":setting", "overridden", "typeClass"],
content: Ember.computed.alias("setting"), content: alias("setting"),
validationMessage: null, validationMessage: null,
isSecret: Ember.computed.oneWay("setting.secret"), isSecret: oneWay("setting.secret"),
@computed("buffered.value", "setting.value") @computed("buffered.value", "setting.value")
dirty(bufferVal, settingVal) { dirty(bufferVal, settingVal) {

View File

@ -1,3 +1,4 @@
import { filter, or, gt, lt, not } from "@ember/object/computed";
import { iconHTML } from "discourse-common/lib/icon-library"; import { iconHTML } from "discourse-common/lib/icon-library";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
import computed from "ember-addons/ember-computed-decorators"; import computed from "ember-addons/ember-computed-decorators";
@ -11,16 +12,16 @@ const wrapAdmin = user => (user ? AdminUser.create(user) : null);
const AdminUser = Discourse.User.extend({ const AdminUser = Discourse.User.extend({
adminUserView: true, adminUserView: true,
customGroups: Ember.computed.filter( customGroups: filter(
"groups", "groups",
g => !g.automatic && Group.create(g) g => !g.automatic && Group.create(g)
), ),
automaticGroups: Ember.computed.filter( automaticGroups: filter(
"groups", "groups",
g => g.automatic && Group.create(g) g => g.automatic && Group.create(g)
), ),
canViewProfile: Ember.computed.or("active", "staged"), canViewProfile: or("active", "staged"),
@computed("bounce_score", "reset_bounce_score_after") @computed("bounce_score", "reset_bounce_score_after")
bounceScore(bounce_score, reset_bounce_score_after) { bounceScore(bounce_score, reset_bounce_score_after) {
@ -49,7 +50,7 @@ const AdminUser = Discourse.User.extend({
return Discourse.getURL("/admin/email/bounced"); return Discourse.getURL("/admin/email/bounced");
}, },
canResetBounceScore: Ember.computed.gt("bounce_score", 0), canResetBounceScore: gt("bounce_score", 0),
resetBounceScore() { resetBounceScore() {
return ajax(`/admin/users/${this.id}/reset_bounce_score`, { return ajax(`/admin/users/${this.id}/reset_bounce_score`, {
@ -289,9 +290,9 @@ const AdminUser = Discourse.User.extend({
}); });
}, },
canLockTrustLevel: Ember.computed.lt("trust_level", 4), canLockTrustLevel: lt("trust_level", 4),
canSuspend: Ember.computed.not("staff"), canSuspend: not("staff"),
@computed("suspended_till", "suspended_at") @computed("suspended_till", "suspended_at")
suspendDuration(suspendedTill, suspendedAt) { suspendDuration(suspendedTill, suspendedAt) {
@ -557,9 +558,9 @@ AdminUser.reopenClass({
}); });
}, },
findAll(query, filter) { findAll(query, userFilter) {
return ajax(`/admin/users/list/${query}.json`, { return ajax(`/admin/users/list/${query}.json`, {
data: filter data: userFilter
}).then(users => users.map(u => AdminUser.create(u))); }).then(users => users.map(u => AdminUser.create(u)));
} }
}); });

View File

@ -1,7 +1,8 @@
import { not } from "@ember/object/computed";
import computed from "ember-addons/ember-computed-decorators"; import computed from "ember-addons/ember-computed-decorators";
export default Discourse.Model.extend({ export default Discourse.Model.extend({
restoreDisabled: Ember.computed.not("restoreEnabled"), restoreDisabled: not("restoreEnabled"),
@computed("allowRestore", "isOperationRunning") @computed("allowRestore", "isOperationRunning")
restoreEnabled(allowRestore, isOperationRunning) { restoreEnabled(allowRestore, isOperationRunning) {

View File

@ -1,3 +1,4 @@
import { not } from "@ember/object/computed";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
import ColorSchemeColor from "admin/models/color-scheme-color"; import ColorSchemeColor from "admin/models/color-scheme-color";
import computed from "ember-addons/ember-computed-decorators"; import computed from "ember-addons/ember-computed-decorators";
@ -59,7 +60,7 @@ const ColorScheme = Discourse.Model.extend(Ember.Copyable, {
return !changed || this.saving || this.colors.any(c => !c.get("valid")); return !changed || this.saving || this.colors.any(c => !c.get("valid"));
}, },
newRecord: Ember.computed.not("id"), newRecord: not("id"),
save(opts) { save(opts) {
if (this.is_base || this.disableSave) return; if (this.is_base || this.disableSave) return;

View File

@ -1,3 +1,4 @@
import { equal } from "@ember/object/computed";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
import computed from "ember-addons/ember-computed-decorators"; import computed from "ember-addons/ember-computed-decorators";
@ -7,7 +8,7 @@ const ScreenedIpAddress = Discourse.Model.extend({
return I18n.t(`admin.logs.screened_ips.actions.${actionName}`); return I18n.t(`admin.logs.screened_ips.actions.${actionName}`);
}, },
isBlocked: Ember.computed.equal("action_name", "block"), isBlocked: equal("action_name", "block"),
@computed("ip_address") @computed("ip_address")
isRange(ipAddress) { isRange(ipAddress) {

View File

@ -1,3 +1,4 @@
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";
import { popupAjaxError } from "discourse/lib/ajax-error"; import { popupAjaxError } from "discourse/lib/ajax-error";
@ -13,9 +14,9 @@ export const COMPONENTS = "components";
const SETTINGS_TYPE_ID = 5; const SETTINGS_TYPE_ID = 5;
const Theme = RestModel.extend({ const Theme = RestModel.extend({
isActive: Ember.computed.or("default", "user_selectable"), isActive: or("default", "user_selectable"),
isPendingUpdates: Ember.computed.gt("remote_theme.commits_behind", 0), isPendingUpdates: gt("remote_theme.commits_behind", 0),
hasEditedFields: Ember.computed.gt("editedFields.length", 0), hasEditedFields: gt("editedFields.length", 0),
@computed("theme_fields.[]") @computed("theme_fields.[]")
targets() { targets() {

View File

@ -12,6 +12,41 @@ var define, requirejs;
inject: Ember.inject.controller inject: Ember.inject.controller
}, },
"@ember/object": { default: Ember.Object }, "@ember/object": { default: Ember.Object },
"@ember/object/computed": {
default: Ember.computed,
alias: Ember.computed.alias,
and: Ember.computed.and,
bool: Ember.computed.bool,
collect: Ember.computed.collect,
deprecatingAlias: Ember.computed.deprecatingAlias,
empty: Ember.computed.empty,
equal: Ember.computed.equal,
filter: Ember.computed.filter,
filterBy: Ember.computed.filterBy,
gt: Ember.computed.gt,
gte: Ember.computed.gte,
intersect: Ember.computed.intersect,
lt: Ember.computed.lt,
lte: Ember.computed.lte,
map: Ember.computed.map,
mapBy: Ember.computed.mapBy,
match: Ember.computed.match,
max: Ember.computed.max,
min: Ember.computed.min,
none: Ember.computed.none,
not: Ember.computed.not,
notEmpty: Ember.computed.notEmpty,
oneWay: Ember.computed.oneWay,
or: Ember.computed.or,
readOnly: Ember.computed.readOnly,
reads: Ember.computed.reads,
setDiff: Ember.computed.setDiff,
sort: Ember.computed.sort,
sum: Ember.computed.sum,
union: Ember.computed.union,
uniq: Ember.computed.uniq,
uniqBy: Ember.computed.uniqBy
},
"@ember/object/mixin": { default: Ember.Mixin }, "@ember/object/mixin": { default: Ember.Mixin },
"@ember/object/proxy": { default: Ember.ObjectProxy }, "@ember/object/proxy": { default: Ember.ObjectProxy },
"@ember/routing/route": { default: Ember.Route }, "@ember/routing/route": { default: Ember.Route },

View File

@ -1,3 +1,4 @@
import { alias } 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";
@ -15,5 +16,5 @@ export default Component.extend({
}, },
attributeBindings: ["data-badge-name", "title"], attributeBindings: ["data-badge-name", "title"],
"data-badge-name": Ember.computed.alias("badge.name") "data-badge-name": alias("badge.name")
}); });

View File

@ -1,9 +1,10 @@
import { alias, not } 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";
export default Component.extend({ export default Component.extend({
loadingMore: Ember.computed.alias("topicList.loadingMore"), loadingMore: alias("topicList.loadingMore"),
loading: Ember.computed.not("loaded"), loading: not("loaded"),
@computed("topicList.loaded") @computed("topicList.loaded")
loaded() { loaded() {

View File

@ -1,3 +1,4 @@
import { alias, filter, or } from "@ember/object/computed";
import Component from "@ember/component"; import Component from "@ember/component";
import { default as computed } from "ember-addons/ember-computed-decorators"; import { default as computed } from "ember-addons/ember-computed-decorators";
@ -6,9 +7,9 @@ export default Component.extend({
classNameBindings: ["hidden:hidden", ":category-breadcrumb"], classNameBindings: ["hidden:hidden", ":category-breadcrumb"],
tagName: "ol", tagName: "ol",
parentCategory: Ember.computed.alias("category.parentCategory"), parentCategory: alias("category.parentCategory"),
parentCategories: Ember.computed.filter("categories", function(c) { parentCategories: filter("categories", function(c) {
if ( if (
c.id === this.site.get("uncategorized_category_id") && c.id === this.site.get("uncategorized_category_id") &&
!this.siteSettings.allow_uncategorized_topics !this.siteSettings.allow_uncategorized_topics
@ -34,7 +35,7 @@ export default Component.extend({
return this.site.mobileView && !category; return this.site.mobileView && !category;
}, },
firstCategory: Ember.computed.or("{parentCategory,category}"), firstCategory: or("{parentCategory,category}"),
@computed("category", "parentCategory") @computed("category", "parentCategory")
secondCategory(category, parentCategory) { secondCategory(category, parentCategory) {

View File

@ -1,3 +1,4 @@
import { alias, equal } from "@ember/object/computed";
import Component from "@ember/component"; import Component from "@ember/component";
import { default as computed } from "ember-addons/ember-computed-decorators"; import { default as computed } from "ember-addons/ember-computed-decorators";
import { import {
@ -19,9 +20,9 @@ const TITLES = {
export default Component.extend({ export default Component.extend({
classNames: ["composer-action-title"], classNames: ["composer-action-title"],
options: Ember.computed.alias("model.replyOptions"), options: alias("model.replyOptions"),
action: Ember.computed.alias("model.action"), action: alias("model.action"),
isEditing: Ember.computed.equal("action", EDIT), isEditing: equal("action", EDIT),
@computed("options", "action") @computed("options", "action")
actionTitle(opts, action) { actionTitle(opts, action) {

View File

@ -1,3 +1,4 @@
import { not } from "@ember/object/computed";
import EmberObject from "@ember/object"; import EmberObject from "@ember/object";
import { scheduleOnce } from "@ember/runloop"; import { scheduleOnce } from "@ember/runloop";
import Component from "@ember/component"; import Component from "@ember/component";
@ -16,7 +17,7 @@ export default Component.extend({
_yourselfConfirm: null, _yourselfConfirm: null,
similarTopics: null, similarTopics: null,
hidden: Ember.computed.not("composer.viewOpenOrFullscreen"), hidden: not("composer.viewOpenOrFullscreen"),
didInsertElement() { didInsertElement() {
this._super(...arguments); this._super(...arguments);

View File

@ -1,3 +1,4 @@
import { alias, or } from "@ember/object/computed";
import { next } from "@ember/runloop"; import { next } from "@ember/runloop";
import { debounce } from "@ember/runloop"; import { debounce } from "@ember/runloop";
import { schedule } from "@ember/runloop"; import { schedule } from "@ember/runloop";
@ -13,8 +14,8 @@ import afterTransition from "discourse/lib/after-transition";
export default Component.extend({ export default Component.extend({
classNames: ["title-input"], classNames: ["title-input"],
watchForLink: Ember.computed.alias("composer.canEditTopicFeaturedLink"), watchForLink: alias("composer.canEditTopicFeaturedLink"),
disabled: Ember.computed.or("composer.loading", "composer.disableTitleInput"), disabled: or("composer.loading", "composer.disableTitleInput"),
didInsertElement() { didInsertElement() {
this._super(...arguments); this._super(...arguments);

View File

@ -1,3 +1,4 @@
import { alias } 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";
import { observes } from "ember-addons/ember-computed-decorators"; import { observes } from "ember-addons/ember-computed-decorators";
@ -12,7 +13,7 @@ export default Component.extend({
publicPostCount: null, publicPostCount: null,
requiredTopics: 5, requiredTopics: 5,
requiredPosts: Ember.computed.alias("siteSettings.tl1_requires_read_posts"), requiredPosts: alias("siteSettings.tl1_requires_read_posts"),
init() { init() {
this._super(...arguments); this._super(...arguments);

View File

@ -1,3 +1,4 @@
import { notEmpty, empty } from "@ember/object/computed";
import Component from "@ember/component"; import Component from "@ember/component";
import { default as computed } from "ember-addons/ember-computed-decorators"; import { default as computed } from "ember-addons/ember-computed-decorators";
import DiscourseURL from "discourse/lib/url"; import DiscourseURL from "discourse/lib/url";
@ -21,7 +22,7 @@ export default Component.extend({
"type" "type"
], ],
btnIcon: Ember.computed.notEmpty("icon"), btnIcon: notEmpty("icon"),
@computed("icon", "translatedLabel") @computed("icon", "translatedLabel")
btnType(icon, translatedLabel) { btnType(icon, translatedLabel) {
@ -32,7 +33,7 @@ export default Component.extend({
} }
}, },
noText: Ember.computed.empty("translatedLabel"), noText: empty("translatedLabel"),
@computed("title") @computed("title")
translatedTitle: { translatedTitle: {

View File

@ -1,3 +1,4 @@
import { equal } from "@ember/object/computed";
import Component from "@ember/component"; import Component from "@ember/component";
export default Component.extend({ export default Component.extend({
classNames: ["d-date-time-input-range"], classNames: ["d-date-time-input-range"],
@ -11,8 +12,8 @@ export default Component.extend({
showToTime: true, showToTime: true,
error: null, error: null,
fromPanelActive: Ember.computed.equal("currentPanel", "from"), fromPanelActive: equal("currentPanel", "from"),
toPanelActive: Ember.computed.equal("currentPanel", "to"), toPanelActive: equal("currentPanel", "to"),
_valid(state) { _valid(state) {
if (state.to < state.from) { if (state.to < state.from) {

View File

@ -1,3 +1,4 @@
import { or } 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";
import KeyValueStore from "discourse/lib/key-value-store"; import KeyValueStore from "discourse/lib/key-value-store";
@ -79,7 +80,7 @@ export default Component.extend({
} }
}, },
isEnabled: Ember.computed.or("isEnabledDesktop", "isEnabledPush"), isEnabled: or("isEnabledDesktop", "isEnabledPush"),
isPushNotificationsPreferred() { isPushNotificationsPreferred() {
if (!this.site.mobileView) { if (!this.site.mobileView) {

View File

@ -1,3 +1,4 @@
import { alias } from "@ember/object/computed";
import { throttle } from "@ember/runloop"; import { throttle } from "@ember/runloop";
import { schedule } from "@ember/runloop"; import { schedule } from "@ember/runloop";
import { scheduleOnce } from "@ember/runloop"; import { scheduleOnce } from "@ember/runloop";
@ -24,7 +25,7 @@ export default Component.extend(
Scrolling, Scrolling,
MobileScrollDirection, MobileScrollDirection,
{ {
userFilters: Ember.computed.alias("topic.userFilters"), userFilters: alias("topic.userFilters"),
classNameBindings: [ classNameBindings: [
"multiSelect", "multiSelect",
"topic.archetype", "topic.archetype",
@ -37,8 +38,8 @@ export default Component.extend(
menuVisible: true, menuVisible: true,
SHORT_POST: 1200, SHORT_POST: 1200,
postStream: Ember.computed.alias("topic.postStream"), postStream: alias("topic.postStream"),
archetype: Ember.computed.alias("topic.archetype"), archetype: alias("topic.archetype"),
dockAt: 0, dockAt: 0,
_lastShowTopic: null, _lastShowTopic: null,

View File

@ -1,3 +1,4 @@
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";
import Category from "discourse/models/category"; import Category from "discourse/models/category";
@ -10,7 +11,7 @@ export default buildCategoryPanel("general", {
this.foregroundColors = ["FFFFFF", "000000"]; this.foregroundColors = ["FFFFFF", "000000"];
}, },
canSelectParentCategory: Ember.computed.not( canSelectParentCategory: not(
"category.isUncategorizedCategory" "category.isUncategorizedCategory"
), ),
uncategorizedSiteSettingLink: Discourse.getURL( uncategorizedSiteSettingLink: Discourse.getURL(

View File

@ -1,3 +1,4 @@
import { equal } from "@ember/object/computed";
import Component from "@ember/component"; import Component from "@ember/component";
const EditCategoryPanel = Component.extend({}); const EditCategoryPanel = Component.extend({});
@ -6,7 +7,7 @@ export default EditCategoryPanel;
export function buildCategoryPanel(tab, extras) { export function buildCategoryPanel(tab, extras) {
return EditCategoryPanel.extend( return EditCategoryPanel.extend(
{ {
activeTab: Ember.computed.equal("selectedTab", tab), activeTab: equal("selectedTab", tab),
classNameBindings: [ classNameBindings: [
":modal-tab", ":modal-tab",
"activeTab::hide", "activeTab::hide",

View File

@ -1,3 +1,4 @@
import { empty, and } from "@ember/object/computed";
import { setting } from "discourse/lib/computed"; import { setting } from "discourse/lib/computed";
import { buildCategoryPanel } from "discourse/components/edit-category-panel"; import { buildCategoryPanel } from "discourse/components/edit-category-panel";
import computed from "ember-addons/ember-computed-decorators"; import computed from "ember-addons/ember-computed-decorators";
@ -12,12 +13,12 @@ export function addCategorySortCriteria(criteria) {
export default buildCategoryPanel("settings", { export default buildCategoryPanel("settings", {
emailInEnabled: setting("email_in"), emailInEnabled: setting("email_in"),
showPositionInput: setting("fixed_category_positions"), showPositionInput: setting("fixed_category_positions"),
isParentCategory: Ember.computed.empty("category.parent_category_id"), isParentCategory: empty("category.parent_category_id"),
showSubcategoryListStyle: Ember.computed.and( showSubcategoryListStyle: and(
"category.show_subcategory_list", "category.show_subcategory_list",
"isParentCategory" "isParentCategory"
), ),
isDefaultSortOrder: Ember.computed.empty("category.sort_order"), isDefaultSortOrder: empty("category.sort_order"),
@computed @computed
availableSubcategoryListStyles() { availableSubcategoryListStyles() {

View File

@ -1,9 +1,10 @@
import { empty, and } from "@ember/object/computed";
import { buildCategoryPanel } from "discourse/components/edit-category-panel"; import { buildCategoryPanel } from "discourse/components/edit-category-panel";
export default buildCategoryPanel("tags", { export default buildCategoryPanel("tags", {
allowedTagsEmpty: Ember.computed.empty("category.allowed_tags"), allowedTagsEmpty: empty("category.allowed_tags"),
allowedTagGroupsEmpty: Ember.computed.empty("category.allowed_tag_groups"), allowedTagGroupsEmpty: empty("category.allowed_tag_groups"),
disableAllowGlobalTags: Ember.computed.and( disableAllowGlobalTags: and(
"allowedTagsEmpty", "allowedTagsEmpty",
"allowedTagGroupsEmpty" "allowedTagGroupsEmpty"
) )

View File

@ -1,3 +1,4 @@
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";
import { import {
@ -16,17 +17,17 @@ import {
} from "discourse/controllers/edit-topic-timer"; } from "discourse/controllers/edit-topic-timer";
export default Component.extend({ export default Component.extend({
selection: Ember.computed.alias("topicTimer.status_type"), selection: alias("topicTimer.status_type"),
autoOpen: Ember.computed.equal("selection", OPEN_STATUS_TYPE), autoOpen: equal("selection", OPEN_STATUS_TYPE),
autoClose: Ember.computed.equal("selection", CLOSE_STATUS_TYPE), autoClose: equal("selection", CLOSE_STATUS_TYPE),
autoDelete: Ember.computed.equal("selection", DELETE_STATUS_TYPE), autoDelete: equal("selection", DELETE_STATUS_TYPE),
autoBump: Ember.computed.equal("selection", BUMP_TYPE), autoBump: equal("selection", BUMP_TYPE),
publishToCategory: Ember.computed.equal( publishToCategory: equal(
"selection", "selection",
PUBLISH_TO_CATEGORY_STATUS_TYPE PUBLISH_TO_CATEGORY_STATUS_TYPE
), ),
reminder: Ember.computed.equal("selection", REMINDER_TYPE), reminder: equal("selection", REMINDER_TYPE),
showTimeOnly: Ember.computed.or( showTimeOnly: or(
"autoOpen", "autoOpen",
"autoDelete", "autoDelete",
"reminder", "reminder",

View File

@ -1,3 +1,4 @@
import { notEmpty, not } from "@ember/object/computed";
import Component from "@ember/component"; import Component from "@ember/component";
import { default as computed } from "ember-addons/ember-computed-decorators"; import { default as computed } from "ember-addons/ember-computed-decorators";
import UploadMixin from "discourse/mixins/upload"; import UploadMixin from "discourse/mixins/upload";
@ -5,8 +6,8 @@ import UploadMixin from "discourse/mixins/upload";
export default Component.extend(UploadMixin, { export default Component.extend(UploadMixin, {
type: "emoji", type: "emoji",
uploadUrl: "/admin/customize/emojis", uploadUrl: "/admin/customize/emojis",
hasName: Ember.computed.notEmpty("name"), hasName: notEmpty("name"),
addDisabled: Ember.computed.not("hasName"), addDisabled: not("hasName"),
uploadOptions() { uploadOptions() {
return { return {

View File

@ -1,3 +1,4 @@
import { and, not, equal } from "@ember/object/computed";
import Component from "@ember/component"; import Component from "@ember/component";
import { MAX_MESSAGE_LENGTH } from "discourse/models/post-action-type"; import { MAX_MESSAGE_LENGTH } from "discourse/models/post-action-type";
import computed from "ember-addons/ember-computed-decorators"; import computed from "ember-addons/ember-computed-decorators";
@ -24,9 +25,9 @@ export default Component.extend({
return flag === selectedFlag; return flag === selectedFlag;
}, },
showMessageInput: Ember.computed.and("flag.is_custom_flag", "selected"), showMessageInput: and("flag.is_custom_flag", "selected"),
showDescription: Ember.computed.not("showMessageInput"), showDescription: not("showMessageInput"),
isNotifyUser: Ember.computed.equal("flag.name_key", "notify_user"), isNotifyUser: equal("flag.name_key", "notify_user"),
@computed("flag.description", "flag.short_description") @computed("flag.description", "flag.short_description")
description(long_description, short_description) { description(long_description, short_description) {

View File

@ -1,3 +1,4 @@
import { equal, and, empty } from "@ember/object/computed";
import Component from "@ember/component"; import Component from "@ember/component";
import { import {
default as computed, default as computed,
@ -11,12 +12,12 @@ export default Component.extend({
date: null, date: null,
time: null, time: null,
includeDateTime: true, includeDateTime: true,
isCustom: Ember.computed.equal("selection", "pick_date_and_time"), isCustom: equal("selection", "pick_date_and_time"),
isBasedOnLastPost: Ember.computed.equal( isBasedOnLastPost: equal(
"selection", "selection",
"set_based_on_last_post" "set_based_on_last_post"
), ),
displayDateAndTimePicker: Ember.computed.and("includeDateTime", "isCustom"), displayDateAndTimePicker: and("includeDateTime", "isCustom"),
displayLabel: null, displayLabel: null,
init() { init() {
@ -37,7 +38,7 @@ export default Component.extend({
} }
}, },
timeInputDisabled: Ember.computed.empty("date"), timeInputDisabled: empty("date"),
@observes("date", "time") @observes("date", "time")
_updateInput() { _updateInput() {

View File

@ -1,3 +1,4 @@
import { alias } 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";
@ -5,7 +6,7 @@ export default Component.extend({
classNames: ["google-search-form"], classNames: ["google-search-form"],
classNameBindings: ["hidden:hidden"], classNameBindings: ["hidden:hidden"],
hidden: Ember.computed.alias("siteSettings.login_required"), hidden: alias("siteSettings.login_required"),
@computed @computed
siteUrl() { siteUrl() {

View File

@ -1,3 +1,4 @@
import { alias, match, gt, or } from "@ember/object/computed";
import Component from "@ember/component"; import Component from "@ember/component";
import { setting } from "discourse/lib/computed"; import { setting } from "discourse/lib/computed";
import { default as computed } from "ember-addons/ember-computed-decorators"; import { default as computed } from "ember-addons/ember-computed-decorators";
@ -21,11 +22,11 @@ export default Component.extend(CardContentsBase, CleansUp, {
allowBackgrounds: setting("allow_profile_backgrounds"), allowBackgrounds: setting("allow_profile_backgrounds"),
showBadges: setting("enable_badges"), showBadges: setting("enable_badges"),
postStream: Ember.computed.alias("topic.postStream"), postStream: alias("topic.postStream"),
viewingTopic: Ember.computed.match("currentPath", /^topic\./), viewingTopic: match("currentPath", /^topic\./),
showMoreMembers: Ember.computed.gt("moreMembersCount", 0), showMoreMembers: gt("moreMembersCount", 0),
hasMembersOrIsMember: Ember.computed.or( hasMembersOrIsMember: or(
"group.members", "group.members",
"group.is_group_owner_display", "group.is_group_owner_display",
"group.is_group_user" "group.is_group_user"

View File

@ -1,3 +1,4 @@
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";
import { popupAjaxError } from "discourse/lib/ajax-error"; import { popupAjaxError } from "discourse/lib/ajax-error";
@ -29,7 +30,7 @@ export default Component.extend({
return !usernames || !(usernames.length > 0); return !usernames || !(usernames.length > 0);
}, },
showingFirst: Ember.computed.lte("currentPage", 1), showingFirst: lte("currentPage", 1),
showingLast: propertyEqual("currentPage", "totalPages"), showingLast: propertyEqual("currentPage", "totalPages"),
actions: { actions: {

View File

@ -1,3 +1,4 @@
import { not } from "@ember/object/computed";
import Component from "@ember/component"; import Component from "@ember/component";
import { import {
default as computed, default as computed,
@ -22,7 +23,7 @@ export default Component.extend({
} }
}, },
canEdit: Ember.computed.not("model.automatic"), canEdit: not("model.automatic"),
@computed("basicNameValidation", "uniqueNameValidation") @computed("basicNameValidation", "uniqueNameValidation")
nameValidation(basicNameValidation, uniqueNameValidation) { nameValidation(basicNameValidation, uniqueNameValidation) {

View File

@ -1,3 +1,4 @@
import { alias, not } from "@ember/object/computed";
import Component from "@ember/component"; import Component from "@ember/component";
import { bufferedRender } from "discourse-common/lib/buffered-render"; import { bufferedRender } from "discourse-common/lib/buffered-render";
import { iconHTML } from "discourse-common/lib/icon-library"; import { iconHTML } from "discourse-common/lib/icon-library";
@ -7,8 +8,8 @@ export default Component.extend(
classNameBindings: [":tip", "good", "bad"], classNameBindings: [":tip", "good", "bad"],
rerenderTriggers: ["validation"], rerenderTriggers: ["validation"],
bad: Ember.computed.alias("validation.failed"), bad: alias("validation.failed"),
good: Ember.computed.not("bad"), good: not("bad"),
buildBuffer(buffer) { buildBuffer(buffer) {
const reason = this.get("validation.reason"); const reason = this.get("validation.reason");

View File

@ -1,3 +1,4 @@
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";
import { emailValid } from "discourse/lib/utilities"; import { emailValid } from "discourse/lib/utilities";
@ -9,8 +10,8 @@ import { i18n } from "discourse/lib/computed";
export default Component.extend({ export default Component.extend({
tagName: null, tagName: null,
inviteModel: Ember.computed.alias("panel.model.inviteModel"), inviteModel: alias("panel.model.inviteModel"),
userInvitedShow: Ember.computed.alias("panel.model.userInvitedShow"), userInvitedShow: alias("panel.model.userInvitedShow"),
// If this isn't defined, it will proxy to the user topic on the preferences // If this isn't defined, it will proxy to the user topic on the preferences
// page which is wrong. // page which is wrong.
@ -20,7 +21,7 @@ export default Component.extend({
inviteIcon: "envelope", inviteIcon: "envelope",
invitingExistingUserToTopic: false, invitingExistingUserToTopic: false,
isAdmin: Ember.computed.alias("currentUser.admin"), isAdmin: alias("currentUser.admin"),
willDestroyElement() { willDestroyElement() {
this._super(...arguments); this._super(...arguments);
@ -137,18 +138,18 @@ export default Component.extend({
return canInviteViaEmail && !isPM; return canInviteViaEmail && !isPM;
}, },
topicId: Ember.computed.alias("inviteModel.id"), topicId: alias("inviteModel.id"),
// eg: visible only to specific group members // eg: visible only to specific group members
isPrivateTopic: Ember.computed.and( isPrivateTopic: and(
"invitingToTopic", "invitingToTopic",
"inviteModel.category.read_restricted" "inviteModel.category.read_restricted"
), ),
isPM: Ember.computed.equal("inviteModel.archetype", "private_message"), isPM: equal("inviteModel.archetype", "private_message"),
// scope to allowed usernames // scope to allowed usernames
allowExistingMembers: Ember.computed.alias("invitingToTopic"), allowExistingMembers: alias("invitingToTopic"),
@computed("isAdmin", "inviteModel.group_users") @computed("isAdmin", "inviteModel.group_users")
isGroupOwnerOrAdmin(isAdmin, groupUsers) { isGroupOwnerOrAdmin(isAdmin, groupUsers) {

View File

@ -1,3 +1,4 @@
import { equal, alias } from "@ember/object/computed";
import Component from "@ember/component"; import Component from "@ember/component";
import { propertyEqual } from "discourse/lib/computed"; import { propertyEqual } from "discourse/lib/computed";
@ -8,8 +9,8 @@ export default Component.extend({
selectedPanel: null, selectedPanel: null,
panelsLength: null, panelsLength: null,
classNameBindings: ["isActive", "singleTab", "panel.id"], classNameBindings: ["isActive", "singleTab", "panel.id"],
singleTab: Ember.computed.equal("panelsLength", 1), singleTab: equal("panelsLength", 1),
title: Ember.computed.alias("panel.title"), title: alias("panel.title"),
isActive: propertyEqual("panel.id", "selectedPanel.id"), isActive: propertyEqual("panel.id", "selectedPanel.id"),
click() { click() {

View File

@ -1,3 +1,4 @@
import { alias, not } from "@ember/object/computed";
import Component from "@ember/component"; import Component from "@ember/component";
import { iconHTML } from "discourse-common/lib/icon-library"; import { iconHTML } from "discourse-common/lib/icon-library";
import { import {
@ -19,8 +20,8 @@ export default Component.extend(
this.set("validation.lastShownAt", null); this.set("validation.lastShownAt", null);
}, },
bad: Ember.computed.alias("validation.failed"), bad: alias("validation.failed"),
good: Ember.computed.not("bad"), good: not("bad"),
@computed("shownAt", "validation.lastShownAt") @computed("shownAt", "validation.lastShownAt")
lastShownAt(shownAt, lastShownAt) { lastShownAt(shownAt, lastShownAt) {

View File

@ -1,9 +1,10 @@
import { gt, alias } from "@ember/object/computed";
import Component from "@ember/component"; import Component from "@ember/component";
export default Component.extend({ export default Component.extend({
tagName: "", tagName: "",
multiple: Ember.computed.gt("bundle.actions.length", 1), multiple: gt("bundle.actions.length", 1),
first: Ember.computed.alias("bundle.actions.firstObject"), first: alias("bundle.actions.firstObject"),
actions: { actions: {
performById(id) { performById(id) {

View File

@ -1,4 +1,5 @@
import { gte } from "@ember/object/computed";
import Component from "@ember/component"; import Component from "@ember/component";
export default Component.extend({ export default Component.extend({
showUsername: Ember.computed.gte("index", 1) showUsername: gte("index", 1)
}); });

View File

@ -1,3 +1,4 @@
import { gt } 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";
import { longDate } from "discourse/lib/formatter"; import { longDate } from "discourse/lib/formatter";
@ -5,7 +6,7 @@ import { historyHeat } from "discourse/widgets/post-edits-indicator";
import showModal from "discourse/lib/show-modal"; import showModal from "discourse/lib/show-modal";
export default Component.extend({ export default Component.extend({
hasEdits: Ember.computed.gt("reviewable.post_version", 1), hasEdits: gt("reviewable.post_version", 1),
@computed("reviewable.post_updated_at") @computed("reviewable.post_updated_at")
historyClass(updatedAt) { historyClass(updatedAt) {

View File

@ -1,4 +1,5 @@
import { filterBy } from "@ember/object/computed";
import Component from "@ember/component"; import Component from "@ember/component";
export default Component.extend({ export default Component.extend({
filteredHistories: Ember.computed.filterBy("histories", "created", false) filteredHistories: filterBy("histories", "created", false)
}); });

View File

@ -1,3 +1,4 @@
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";
import { escapeExpression } from "discourse/lib/utilities"; import { escapeExpression } from "discourse/lib/utilities";
@ -7,9 +8,9 @@ import Sharing from "discourse/lib/sharing";
export default Component.extend({ export default Component.extend({
tagName: null, tagName: null,
type: Ember.computed.alias("panel.model.type"), type: alias("panel.model.type"),
topic: Ember.computed.alias("panel.model.topic"), topic: alias("panel.model.topic"),
@computed @computed
sources() { sources() {

View File

@ -1,3 +1,4 @@
import { sort } 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";
@ -5,7 +6,7 @@ export default Component.extend({
classNameBindings: [":tag-list", "categoryClass", "tagGroupNameClass"], classNameBindings: [":tag-list", "categoryClass", "tagGroupNameClass"],
isPrivateMessage: false, isPrivateMessage: false,
sortedTags: Ember.computed.sort("tags", "sortProperties"), sortedTags: sort("tags", "sortProperties"),
@computed("titleKey") @computed("titleKey")
title(titleKey) { title(titleKey) {

View File

@ -1,3 +1,4 @@
import { oneWay, 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";
import { isNumeric } from "discourse/lib/utilities"; import { isNumeric } from "discourse/lib/utilities";
@ -6,11 +7,11 @@ export default Component.extend({
classNames: ["d-time-input"], classNames: ["d-time-input"],
hours: null, hours: null,
minutes: null, minutes: null,
_hours: Ember.computed.oneWay("hours"), _hours: oneWay("hours"),
_minutes: Ember.computed.oneWay("minutes"), _minutes: oneWay("minutes"),
isSafari: Ember.computed.oneWay("capabilities.isSafari"), isSafari: oneWay("capabilities.isSafari"),
isMobile: Ember.computed.oneWay("site.mobileView"), isMobile: oneWay("site.mobileView"),
nativePicker: Ember.computed.or("isSafari", "isMobile"), nativePicker: or("isSafari", "isMobile"),
actions: { actions: {
onInput(options, event) { onInput(options, event) {

View File

@ -1,3 +1,4 @@
import { alias, or, and } 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";
import { getTopicFooterButtons } from "discourse/lib/register-topic-footer-button"; import { getTopicFooterButtons } from "discourse/lib/register-topic-footer-button";
@ -31,11 +32,11 @@ export default Component.extend({
return !isPM || this.siteSettings.enable_personal_messages; return !isPM || this.siteSettings.enable_personal_messages;
}, },
canInviteTo: Ember.computed.alias("topic.details.can_invite_to"), canInviteTo: alias("topic.details.can_invite_to"),
canDefer: Ember.computed.alias("currentUser.enable_defer"), canDefer: alias("currentUser.enable_defer"),
inviteDisabled: Ember.computed.or( inviteDisabled: or(
"topic.archived", "topic.archived",
"topic.closed", "topic.closed",
"topic.deleted" "topic.deleted"
@ -50,7 +51,7 @@ export default Component.extend({
); );
}, },
showEditOnFooter: Ember.computed.and( showEditOnFooter: and(
"topic.isPrivateMessage", "topic.isPrivateMessage",
"site.can_tag_pms" "site.can_tag_pms"
), ),

View File

@ -1,3 +1,4 @@
import { alias } from "@ember/object/computed";
import Component from "@ember/component"; import Component from "@ember/component";
import DiscourseURL from "discourse/lib/url"; import DiscourseURL from "discourse/lib/url";
import computed from "ember-addons/ember-computed-decorators"; import computed from "ember-addons/ember-computed-decorators";
@ -34,7 +35,7 @@ export const ListItemDefaults = {
tagName: "tr", tagName: "tr",
classNameBindings: [":topic-list-item", "unboundClassNames", "topic.visited"], classNameBindings: [":topic-list-item", "unboundClassNames", "topic.visited"],
attributeBindings: ["data-topic-id"], attributeBindings: ["data-topic-id"],
"data-topic-id": Ember.computed.alias("topic.id"), "data-topic-id": alias("topic.id"),
didInsertElement() { didInsertElement() {
this._super(...arguments); this._super(...arguments);

View File

@ -1,3 +1,4 @@
import { alias, reads } from "@ember/object/computed";
import { schedule } from "@ember/runloop"; import { schedule } from "@ember/runloop";
import Component from "@ember/component"; import Component from "@ember/component";
import { import {
@ -13,7 +14,7 @@ export default Component.extend(LoadMore, {
listTitle: "topic.title", listTitle: "topic.title",
// Overwrite this to perform client side filtering of topics, if desired // Overwrite this to perform client side filtering of topics, if desired
filteredTopics: Ember.computed.alias("topics"), filteredTopics: alias("topics"),
_init: Ember.on("init", function() { _init: Ember.on("init", function() {
this.addObserver("hideCategory", this.rerender); this.addObserver("hideCategory", this.rerender);
@ -32,7 +33,7 @@ export default Component.extend(LoadMore, {
return !!this.changeSort; return !!this.changeSort;
}, },
skipHeader: Ember.computed.reads("site.mobileView"), skipHeader: reads("site.mobileView"),
@computed("order") @computed("order")
showLikes(order) { showLikes(order) {

View File

@ -1,3 +1,4 @@
import { alias } from "@ember/object/computed";
import { scheduleOnce } from "@ember/runloop"; import { scheduleOnce } from "@ember/runloop";
import Component from "@ember/component"; import Component from "@ember/component";
import { import {
@ -10,7 +11,7 @@ export default Component.extend({
classNameBindings: ["docked"], classNameBindings: ["docked"],
docked: false, docked: false,
progressPosition: null, progressPosition: null,
postStream: Ember.computed.alias("topic.postStream"), postStream: alias("topic.postStream"),
_streamPercentage: null, _streamPercentage: null,
@computed("progressPosition") @computed("progressPosition")

View File

@ -1,3 +1,4 @@
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";
import { import {
@ -25,28 +26,28 @@ export default Component.extend(CardContentsBase, CanCheckEmails, CleansUp, {
allowBackgrounds: setting("allow_profile_backgrounds"), allowBackgrounds: setting("allow_profile_backgrounds"),
showBadges: setting("enable_badges"), showBadges: setting("enable_badges"),
postStream: Ember.computed.alias("topic.postStream"), postStream: alias("topic.postStream"),
enoughPostsForFiltering: Ember.computed.gte("topicPostCount", 2), enoughPostsForFiltering: gte("topicPostCount", 2),
showFilter: Ember.computed.and( showFilter: and(
"viewingTopic", "viewingTopic",
"postStream.hasNoFilters", "postStream.hasNoFilters",
"enoughPostsForFiltering" "enoughPostsForFiltering"
), ),
showName: propertyNotEqual("user.name", "user.username"), showName: propertyNotEqual("user.name", "user.username"),
hasUserFilters: Ember.computed.gt("postStream.userFilters.length", 0), hasUserFilters: gt("postStream.userFilters.length", 0),
showMoreBadges: Ember.computed.gt("moreBadgesCount", 0), showMoreBadges: gt("moreBadgesCount", 0),
showDelete: Ember.computed.and( showDelete: and(
"viewingAdmin", "viewingAdmin",
"showName", "showName",
"user.canBeDeleted" "user.canBeDeleted"
), ),
linkWebsite: Ember.computed.not("user.isBasic"), linkWebsite: not("user.isBasic"),
hasLocationOrWebsite: Ember.computed.or("user.location", "user.website_name"), hasLocationOrWebsite: or("user.location", "user.website_name"),
isSuspendedOrHasBio: Ember.computed.or( isSuspendedOrHasBio: or(
"user.suspend_reason", "user.suspend_reason",
"user.bio_cooked" "user.bio_cooked"
), ),
showCheckEmail: Ember.computed.and("user.staged", "canCheckEmails"), showCheckEmail: and("user.staged", "canCheckEmails"),
user: null, user: null,

View File

@ -1,3 +1,4 @@
import { alias } 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";
import { userPath } from "discourse/lib/url"; import { userPath } from "discourse/lib/url";
@ -16,10 +17,10 @@ export default Component.extend({
return userPath(username); return userPath(username);
}, },
"data-username": Ember.computed.alias("user.username"), "data-username": alias("user.username"),
// TODO: In later ember releases `hasBlock` works without this // TODO: In later ember releases `hasBlock` works without this
hasBlock: Ember.computed.alias("template"), hasBlock: alias("template"),
@computed("user.name", "user.username") @computed("user.name", "user.username")
name(name, username) { name(name, username) {

View File

@ -1,7 +1,8 @@
import { alias } from "@ember/object/computed";
import Component from "@ember/component"; import Component from "@ember/component";
export default Component.extend({ export default Component.extend({
tagName: "a", tagName: "a",
attributeBindings: ["href", "data-user-card"], attributeBindings: ["href", "data-user-card"],
href: Ember.computed.alias("user.path"), href: alias("user.path"),
"data-user-card": Ember.computed.alias("user.username") "data-user-card": alias("user.username")
}); });

View File

@ -1,7 +1,8 @@
import { equal } from "@ember/object/computed";
import Component from "@ember/component"; import Component from "@ember/component";
export default Component.extend({ export default Component.extend({
classNames: ["user-stat"], classNames: ["user-stat"],
type: "number", type: "number",
isNumber: Ember.computed.equal("type", "number"), isNumber: equal("type", "number"),
isDuration: Ember.computed.equal("type", "duration") isDuration: equal("type", "duration")
}); });

View File

@ -1,8 +1,9 @@
import { gt } 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";
export default Controller.extend({ export default Controller.extend({
faqOverriden: Ember.computed.gt("siteSettings.faq_url.length", 0), faqOverriden: gt("siteSettings.faq_url.length", 0),
@computed @computed
contactInfo() { contactInfo() {

View File

@ -1,3 +1,4 @@
import { empty } from "@ember/object/computed";
import { inject } from "@ember/controller"; import { inject } from "@ember/controller";
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";
@ -19,7 +20,7 @@ export default Controller.extend({
}); });
}, },
disabled: Ember.computed.empty("notificationLevelId"), disabled: empty("notificationLevelId"),
actions: { actions: {
changeNotificationLevel() { changeNotificationLevel() {

View File

@ -1,3 +1,4 @@
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";
import Controller from "@ember/controller"; import Controller from "@ember/controller";
@ -11,10 +12,10 @@ export default Controller.extend(ModalFunctionality, {
saving: false, saving: false,
new_user: null, new_user: null,
selectedPostsCount: Ember.computed.alias( selectedPostsCount: alias(
"topicController.selectedPostsCount" "topicController.selectedPostsCount"
), ),
selectedPostsUsername: Ember.computed.alias( selectedPostsUsername: alias(
"topicController.selectedPostsUsername" "topicController.selectedPostsUsername"
), ),

View File

@ -1,3 +1,4 @@
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";
import { inject } from "@ember/controller"; import { inject } from "@ember/controller";
@ -94,9 +95,9 @@ export default Controller.extend({
topic: null, topic: null,
linkLookup: null, linkLookup: null,
showPreview: true, showPreview: true,
forcePreview: Ember.computed.and("site.mobileView", "showPreview"), forcePreview: and("site.mobileView", "showPreview"),
whisperOrUnlistTopic: Ember.computed.or("isWhispering", "model.unlistTopic"), whisperOrUnlistTopic: or("isWhispering", "model.unlistTopic"),
categories: Ember.computed.alias("site.categoriesList"), categories: alias("site.categoriesList"),
@on("init") @on("init")
_setupPreview() { _setupPreview() {
@ -178,7 +179,7 @@ export default Controller.extend({
} }
}), }),
topicModel: Ember.computed.alias("topicController.model"), topicModel: alias("topicController.model"),
@computed("model.canEditTitle", "model.creatingPrivateMessage") @computed("model.canEditTitle", "model.creatingPrivateMessage")
canEditTags(canEditTitle, creatingPrivateMessage) { canEditTags(canEditTitle, creatingPrivateMessage) {
@ -200,9 +201,9 @@ export default Controller.extend({
return editingPost && !canEditTags; return editingPost && !canEditTags;
}, },
isStaffUser: Ember.computed.reads("currentUser.staff"), isStaffUser: reads("currentUser.staff"),
canUnlistTopic: Ember.computed.and("model.creatingTopic", "isStaffUser"), canUnlistTopic: and("model.creatingTopic", "isStaffUser"),
@computed("canWhisper", "replyingToWhisper") @computed("canWhisper", "replyingToWhisper")
showWhisperToggle(canWhisper, replyingToWhisper) { showWhisperToggle(canWhisper, replyingToWhisper) {
@ -216,7 +217,7 @@ export default Controller.extend({
); );
}, },
isWhispering: Ember.computed.or("replyingToWhisper", "model.whisper"), isWhispering: or("replyingToWhisper", "model.whisper"),
@computed("model.action", "isWhispering") @computed("model.action", "isWhispering")
saveIcon(action, isWhispering) { saveIcon(action, isWhispering) {
@ -590,7 +591,7 @@ export default Controller.extend({
} }
}, },
disableSubmit: Ember.computed.or("model.loading", "isUploading"), disableSubmit: or("model.loading", "isUploading"),
save(force) { save(force) {
if (this.disableSubmit) return; if (this.disableSubmit) return;

View File

@ -1,3 +1,4 @@
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";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
@ -34,9 +35,9 @@ export default Controller.extend(
userFields: null, userFields: null,
isDeveloper: false, isDeveloper: false,
hasAuthOptions: Ember.computed.notEmpty("authOptions"), hasAuthOptions: notEmpty("authOptions"),
canCreateLocal: setting("enable_local_logins"), canCreateLocal: setting("enable_local_logins"),
showCreateForm: Ember.computed.or("hasAuthOptions", "canCreateLocal"), showCreateForm: or("hasAuthOptions", "canCreateLocal"),
resetForm() { resetForm() {
// We wrap the fields in a structure so we can assign a value // We wrap the fields in a structure so we can assign a value
@ -78,7 +79,7 @@ export default Controller.extend(
return false; return false;
}, },
usernameRequired: Ember.computed.not("authOptions.omit_username"), usernameRequired: not("authOptions.omit_username"),
@computed @computed
fullnameRequired() { fullnameRequired() {

View File

@ -1,3 +1,4 @@
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";
import DiscourseNavigation from "discourse/components/d-navigation"; import DiscourseNavigation from "discourse/components/d-navigation";
@ -24,7 +25,7 @@ const controllerOpts = {
// Aliases for the values // Aliases for the values
controllerOpts.queryParams.forEach( controllerOpts.queryParams.forEach(
p => (controllerOpts[p] = Ember.computed.alias(`discoveryTopics.${p}`)) p => (controllerOpts[p] = alias(`discoveryTopics.${p}`))
); );
const SortableController = Controller.extend(controllerOpts); const SortableController = Controller.extend(controllerOpts);
@ -32,7 +33,7 @@ const SortableController = Controller.extend(controllerOpts);
export const addDiscoveryQueryParam = function(p, opts) { export const addDiscoveryQueryParam = function(p, opts) {
queryParams[p] = opts; queryParams[p] = opts;
const cOpts = {}; const cOpts = {};
cOpts[p] = Ember.computed.alias(`discoveryTopics.${p}`); cOpts[p] = alias(`discoveryTopics.${p}`);
cOpts["queryParams"] = Object.keys(queryParams); cOpts["queryParams"] = Object.keys(queryParams);
SortableController.reopen(cOpts); SortableController.reopen(cOpts);

View File

@ -1,3 +1,4 @@
import { alias, 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";
import DiscourseURL from "discourse/lib/url"; import DiscourseURL from "discourse/lib/url";
@ -9,10 +10,10 @@ export default Controller.extend({
loading: false, loading: false,
category: Ember.computed.alias("navigationCategory.category"), category: alias("navigationCategory.category"),
noSubcategories: Ember.computed.alias("navigationCategory.noSubcategories"), noSubcategories: alias("navigationCategory.noSubcategories"),
loadedAllItems: Ember.computed.not("discoveryTopics.model.canLoadMore"), loadedAllItems: not("discoveryTopics.model.canLoadMore"),
_showFooter: function() { _showFooter: function() {
this.set("application.showFooter", this.loadedAllItems); this.set("application.showFooter", this.loadedAllItems);

View File

@ -1,3 +1,4 @@
import { reads } from "@ember/object/computed";
import { inject } from "@ember/controller"; import { inject } from "@ember/controller";
import computed from "ember-addons/ember-computed-decorators"; import computed from "ember-addons/ember-computed-decorators";
import DiscoveryController from "discourse/controllers/discovery"; import DiscoveryController from "discourse/controllers/discovery";
@ -15,7 +16,7 @@ export default DiscoveryController.extend({
// this makes sure the composer isn't scoping to a specific category // this makes sure the composer isn't scoping to a specific category
category: null, category: null,
canEdit: Ember.computed.reads("currentUser.staff"), canEdit: reads("currentUser.staff"),
@computed("model.categories.[].featuredTopics.length") @computed("model.categories.[].featuredTopics.length")
latestTopicOnly() { latestTopicOnly() {

View File

@ -1,3 +1,4 @@
import { alias, not, gt, empty, notEmpty, equal } from "@ember/object/computed";
import { inject } from "@ember/controller"; import { inject } from "@ember/controller";
import DiscoveryController from "discourse/controllers/discovery"; import DiscoveryController from "discourse/controllers/discovery";
import { queryParams } from "discourse/controllers/discovery-sortable"; import { queryParams } from "discourse/controllers/discovery-sortable";
@ -14,9 +15,9 @@ const controllerOpts = {
period: null, period: null,
canStar: Ember.computed.alias("currentUser.id"), canStar: alias("currentUser.id"),
showTopicPostBadges: Ember.computed.not("discoveryTopics.new"), showTopicPostBadges: not("discoveryTopics.new"),
redirectedReason: Ember.computed.alias( redirectedReason: alias(
"currentUser.redirected_to_top.reason" "currentUser.redirected_to_top.reason"
), ),
@ -118,16 +119,16 @@ const controllerOpts = {
); );
}, },
hasTopics: Ember.computed.gt("model.topics.length", 0), hasTopics: gt("model.topics.length", 0),
allLoaded: Ember.computed.empty("model.more_topics_url"), allLoaded: empty("model.more_topics_url"),
latest: endWith("model.filter", "latest"), latest: endWith("model.filter", "latest"),
new: endWith("model.filter", "new"), new: endWith("model.filter", "new"),
top: Ember.computed.notEmpty("period"), top: notEmpty("period"),
yearly: Ember.computed.equal("period", "yearly"), yearly: equal("period", "yearly"),
quarterly: Ember.computed.equal("period", "quarterly"), quarterly: equal("period", "quarterly"),
monthly: Ember.computed.equal("period", "monthly"), monthly: equal("period", "monthly"),
weekly: Ember.computed.equal("period", "weekly"), weekly: equal("period", "weekly"),
daily: Ember.computed.equal("period", "daily"), daily: equal("period", "daily"),
@computed("allLoaded", "model.topics.length") @computed("allLoaded", "model.topics.length")
footerMessage(allLoaded, topicsLength) { footerMessage(allLoaded, topicsLength) {

View File

@ -1,3 +1,4 @@
import { equal, gte, none, alias } from "@ember/object/computed";
import { schedule } from "@ember/runloop"; import { schedule } from "@ember/runloop";
import Controller from "@ember/controller"; import Controller from "@ember/controller";
import { import {
@ -43,10 +44,10 @@ export default Controller.extend({
return false; return false;
}, },
isNotFound: Ember.computed.equal("thrown.status", 404), isNotFound: equal("thrown.status", 404),
isForbidden: Ember.computed.equal("thrown.status", 403), isForbidden: equal("thrown.status", 403),
isServer: Ember.computed.gte("thrown.status", 500), isServer: gte("thrown.status", 500),
isUnknown: Ember.computed.none("isNetwork", "isServer"), isUnknown: none("isNetwork", "isServer"),
// TODO // TODO
// make ajax requests to /srv/status with exponential backoff // make ajax requests to /srv/status with exponential backoff
@ -75,7 +76,7 @@ export default Controller.extend({
} }
}, },
requestUrl: Ember.computed.alias("thrown.requestedUrl"), requestUrl: alias("thrown.requestedUrl"),
@computed("networkFixed", "isNetwork", "isServer", "isUnknown") @computed("networkFixed", "isNetwork", "isServer", "isUnknown")
desc() { desc() {

View File

@ -1,3 +1,4 @@
import { not } from "@ember/object/computed";
import EmberObject from "@ember/object"; import EmberObject from "@ember/object";
import Controller from "@ember/controller"; import Controller from "@ember/controller";
import ModalFunctionality from "discourse/mixins/modal-functionality"; import ModalFunctionality from "discourse/mixins/modal-functionality";
@ -99,7 +100,7 @@ export default Controller.extend(ModalFunctionality, {
return true; return true;
}, },
submitDisabled: Ember.computed.not("submitEnabled"), submitDisabled: not("submitEnabled"),
// Staff accounts can "take action" // Staff accounts can "take action"
@computed("flagTopic", "selected.is_custom_flag") @computed("flagTopic", "selected.is_custom_flag")

View File

@ -1,3 +1,4 @@
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";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
@ -207,7 +208,7 @@ export default Controller.extend({
return page === PAGE_LIMIT; return page === PAGE_LIMIT;
}, },
searchButtonDisabled: Ember.computed.or("searching", "loading"), searchButtonDisabled: or("searching", "loading"),
_search() { _search() {
if (this.searching) { if (this.searching) {

Some files were not shown because too many files have changed in this diff Show More