diff --git a/app/assets/javascripts/admin/components/admin-report-counts.js.es6 b/app/assets/javascripts/admin/components/admin-report-counts.js.es6 index fc0127ec886..625dd669eef 100644 --- a/app/assets/javascripts/admin/components/admin-report-counts.js.es6 +++ b/app/assets/javascripts/admin/components/admin-report-counts.js.es6 @@ -1,8 +1,9 @@ +import { match } from "@ember/object/computed"; import Component from "@ember/component"; export default Component.extend({ allTime: true, tagName: "tr", - reverseColors: Ember.computed.match( + reverseColors: match( "report.type", /^(time_to_first_response|topics_with_no_response)$/ ), diff --git a/app/assets/javascripts/admin/components/admin-report-storage-stats.js.es6 b/app/assets/javascripts/admin/components/admin-report-storage-stats.js.es6 index 51142a6d19c..948ecf1e87c 100644 --- a/app/assets/javascripts/admin/components/admin-report-storage-stats.js.es6 +++ b/app/assets/javascripts/admin/components/admin-report-storage-stats.js.es6 @@ -1,3 +1,4 @@ +import { alias } from "@ember/object/computed"; import Component from "@ember/component"; import { setting } from "discourse/lib/computed"; import computed from "ember-addons/ember-computed-decorators"; @@ -6,8 +7,8 @@ export default Component.extend({ classNames: ["admin-report-storage-stats"], backupLocation: setting("backup_location"), - backupStats: Ember.computed.alias("model.data.backups"), - uploadStats: Ember.computed.alias("model.data.uploads"), + backupStats: alias("model.data.backups"), + uploadStats: alias("model.data.uploads"), @computed("backupStats") showBackupStats(stats) { diff --git a/app/assets/javascripts/admin/components/admin-report-table-cell.js.es6 b/app/assets/javascripts/admin/components/admin-report-table-cell.js.es6 index c2354de73af..f83a33dbfb7 100644 --- a/app/assets/javascripts/admin/components/admin-report-table-cell.js.es6 +++ b/app/assets/javascripts/admin/components/admin-report-table-cell.js.es6 @@ -1,3 +1,4 @@ +import { alias } from "@ember/object/computed"; import Component from "@ember/component"; import computed from "ember-addons/ember-computed-decorators"; @@ -12,8 +13,8 @@ export default Component.extend({ return label.compute(data, options || {}); }, - type: Ember.computed.alias("label.type"), - property: Ember.computed.alias("label.mainProperty"), - formatedValue: Ember.computed.alias("computedLabel.formatedValue"), - value: Ember.computed.alias("computedLabel.value") + type: alias("label.type"), + property: alias("label.mainProperty"), + formatedValue: alias("computedLabel.formatedValue"), + value: alias("computedLabel.value") }); diff --git a/app/assets/javascripts/admin/components/admin-report-table.js.es6 b/app/assets/javascripts/admin/components/admin-report-table.js.es6 index 8df3a96f38c..c82896d577f 100644 --- a/app/assets/javascripts/admin/components/admin-report-table.js.es6 +++ b/app/assets/javascripts/admin/components/admin-report-table.js.es6 @@ -1,3 +1,4 @@ +import { alias } from "@ember/object/computed"; import Component from "@ember/component"; import computed from "ember-addons/ember-computed-decorators"; @@ -8,7 +9,7 @@ export default Component.extend({ classNames: ["admin-report-table"], sortable: false, sortDirection: 1, - perPage: Ember.computed.alias("options.perPage"), + perPage: alias("options.perPage"), page: 0, @computed("model.computedLabels.length") diff --git a/app/assets/javascripts/admin/components/admin-report.js.es6 b/app/assets/javascripts/admin/components/admin-report.js.es6 index 5b3fbdd9a54..025b9496f21 100644 --- a/app/assets/javascripts/admin/components/admin-report.js.es6 +++ b/app/assets/javascripts/admin/components/admin-report.js.es6 @@ -1,3 +1,4 @@ +import { alias, or, and, reads, equal, notEmpty } from "@ember/object/computed"; import EmberObject from "@ember/object"; import { next } from "@ember/runloop"; import Component from "@ember/component"; @@ -57,12 +58,12 @@ export default Component.extend({ showHeader: true, showTitle: true, showFilteringUI: false, - showDatesOptions: Ember.computed.alias("model.dates_filtering"), - showRefresh: Ember.computed.or( + showDatesOptions: alias("model.dates_filtering"), + showRefresh: or( "showDatesOptions", "model.available_filters.length" ), - shouldDisplayTrend: Ember.computed.and("showTrend", "model.prev_period"), + shouldDisplayTrend: and("showTrend", "model.prev_period"), init() { this._super(...arguments); @@ -70,8 +71,8 @@ export default Component.extend({ this._reports = []; }, - startDate: Ember.computed.reads("filters.startDate"), - endDate: Ember.computed.reads("filters.endDate"), + startDate: reads("filters.startDate"), + endDate: reads("filters.endDate"), didReceiveAttrs() { this._super(...arguments); @@ -83,16 +84,16 @@ export default Component.extend({ } }, - showError: Ember.computed.or( + showError: or( "showTimeoutError", "showExceptionError", "showNotFoundError" ), - showNotFoundError: Ember.computed.equal("model.error", "not_found"), - showTimeoutError: Ember.computed.equal("model.error", "timeout"), - showExceptionError: Ember.computed.equal("model.error", "exception"), + showNotFoundError: equal("model.error", "not_found"), + showTimeoutError: equal("model.error", "timeout"), + showExceptionError: equal("model.error", "exception"), - hasData: Ember.computed.notEmpty("model.data"), + hasData: notEmpty("model.data"), @computed("dataSourceName", "model.type") dasherizedDataSourceName(dataSourceName, type) { diff --git a/app/assets/javascripts/admin/components/admin-user-field-item.js.es6 b/app/assets/javascripts/admin/components/admin-user-field-item.js.es6 index f186b291f1e..4c6392635da 100644 --- a/app/assets/javascripts/admin/components/admin-user-field-item.js.es6 +++ b/app/assets/javascripts/admin/components/admin-user-field-item.js.es6 @@ -1,3 +1,4 @@ +import { empty } from "@ember/object/computed"; import { scheduleOnce } from "@ember/runloop"; import Component from "@ember/component"; import UserField from "admin/models/user-field"; @@ -12,7 +13,7 @@ import { } from "ember-addons/ember-computed-decorators"; export default Component.extend(bufferedProperty("userField"), { - editing: Ember.computed.empty("userField.id"), + editing: empty("userField.id"), classNameBindings: [":user-field"], cantMoveUp: propertyEqual("userField", "firstField"), diff --git a/app/assets/javascripts/admin/components/admin-web-hook-event-chooser.js.es6 b/app/assets/javascripts/admin/components/admin-web-hook-event-chooser.js.es6 index 32ca7e4fad4..1c7f6f05a0f 100644 --- a/app/assets/javascripts/admin/components/admin-web-hook-event-chooser.js.es6 +++ b/app/assets/javascripts/admin/components/admin-web-hook-event-chooser.js.es6 @@ -1,9 +1,10 @@ +import { alias } from "@ember/object/computed"; import Component from "@ember/component"; import computed from "ember-addons/ember-computed-decorators"; export default Component.extend({ classNames: ["hook-event"], - typeName: Ember.computed.alias("type.name"), + typeName: alias("type.name"), @computed("typeName") name(typeName) { diff --git a/app/assets/javascripts/admin/components/email-styles-editor.js.es6 b/app/assets/javascripts/admin/components/email-styles-editor.js.es6 index c0b6c732e98..e465c04cba3 100644 --- a/app/assets/javascripts/admin/components/email-styles-editor.js.es6 +++ b/app/assets/javascripts/admin/components/email-styles-editor.js.es6 @@ -1,8 +1,9 @@ +import { reads } from "@ember/object/computed"; import Component from "@ember/component"; import computed from "ember-addons/ember-computed-decorators"; export default Component.extend({ - editorId: Ember.computed.reads("fieldName"), + editorId: reads("fieldName"), @computed("fieldName") currentEditorMode(fieldName) { diff --git a/app/assets/javascripts/admin/components/embeddable-host.js.es6 b/app/assets/javascripts/admin/components/embeddable-host.js.es6 index debb6b25b16..98e1eab93af 100644 --- a/app/assets/javascripts/admin/components/embeddable-host.js.es6 +++ b/app/assets/javascripts/admin/components/embeddable-host.js.es6 @@ -1,3 +1,4 @@ +import { or } from "@ember/object/computed"; import { schedule } from "@ember/runloop"; import Component from "@ember/component"; import { bufferedProperty } from "discourse/mixins/buffered-content"; @@ -10,7 +11,7 @@ export default Component.extend(bufferedProperty("host"), { tagName: "tr", categoryId: null, - editing: Ember.computed.or("host.isNew", "editToggled"), + editing: or("host.isNew", "editToggled"), @on("didInsertElement") @observes("editing") diff --git a/app/assets/javascripts/admin/components/penalty-post-action.js.es6 b/app/assets/javascripts/admin/components/penalty-post-action.js.es6 index 7fefa0f3e5f..8af1f83b160 100644 --- a/app/assets/javascripts/admin/components/penalty-post-action.js.es6 +++ b/app/assets/javascripts/admin/components/penalty-post-action.js.es6 @@ -1,3 +1,4 @@ +import { equal } from "@ember/object/computed"; import { scheduleOnce } from "@ember/runloop"; import Component from "@ember/component"; 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: { penaltyChanged() { diff --git a/app/assets/javascripts/admin/components/save-controls.js.es6 b/app/assets/javascripts/admin/components/save-controls.js.es6 index cc858b15308..b039b0158c2 100644 --- a/app/assets/javascripts/admin/components/save-controls.js.es6 +++ b/app/assets/javascripts/admin/components/save-controls.js.es6 @@ -1,10 +1,11 @@ +import { or } from "@ember/object/computed"; import Component from "@ember/component"; import computed from "ember-addons/ember-computed-decorators"; export default Component.extend({ classNames: ["controls"], - buttonDisabled: Ember.computed.or("model.isSaving", "saveDisabled"), + buttonDisabled: or("model.isSaving", "saveDisabled"), @computed("model.isSaving") savingText(saving) { diff --git a/app/assets/javascripts/admin/components/tags-uploader.js.es6 b/app/assets/javascripts/admin/components/tags-uploader.js.es6 index 1682fd955e9..88f4afc8d97 100644 --- a/app/assets/javascripts/admin/components/tags-uploader.js.es6 +++ b/app/assets/javascripts/admin/components/tags-uploader.js.es6 @@ -1,10 +1,11 @@ +import { alias } from "@ember/object/computed"; import Component from "@ember/component"; import UploadMixin from "discourse/mixins/upload"; export default Component.extend(UploadMixin, { type: "csv", uploadUrl: "/tags/upload", - addDisabled: Ember.computed.alias("uploading"), + addDisabled: alias("uploading"), elementId: "tag-uploader", validateUploadedFilesOptions() { diff --git a/app/assets/javascripts/admin/components/theme-translation.js.es6 b/app/assets/javascripts/admin/components/theme-translation.js.es6 index dcdc4a5fd26..361df489afa 100644 --- a/app/assets/javascripts/admin/components/theme-translation.js.es6 +++ b/app/assets/javascripts/admin/components/theme-translation.js.es6 @@ -1,12 +1,13 @@ +import { alias } from "@ember/object/computed"; import Component from "@ember/component"; import BufferedContent from "discourse/mixins/buffered-content"; import SettingComponent from "admin/mixins/setting-component"; export default Component.extend(BufferedContent, SettingComponent, { layoutName: "admin/templates/components/site-setting", - setting: Ember.computed.alias("translation"), + setting: alias("translation"), type: "string", - settingName: Ember.computed.alias("translation.key"), + settingName: alias("translation.key"), _save() { return this.model.saveTranslation( diff --git a/app/assets/javascripts/admin/components/themes-list-item.js.es6 b/app/assets/javascripts/admin/components/themes-list-item.js.es6 index 6d68f4d8e3b..af30e5a3987 100644 --- a/app/assets/javascripts/admin/components/themes-list-item.js.es6 +++ b/app/assets/javascripts/admin/components/themes-list-item.js.es6 @@ -1,3 +1,4 @@ +import { gt, and } from "@ember/object/computed"; import { schedule } from "@ember/runloop"; import Component from "@ember/component"; import { @@ -13,9 +14,9 @@ export default Component.extend({ childrenExpanded: false, classNames: ["themes-list-item"], classNameBindings: ["theme.selected:selected"], - hasComponents: Ember.computed.gt("children.length", 0), - displayComponents: Ember.computed.and("hasComponents", "theme.isActive"), - displayHasMore: Ember.computed.gt("theme.childThemes.length", MAX_COMPONENTS), + hasComponents: gt("children.length", 0), + displayComponents: and("hasComponents", "theme.isActive"), + displayHasMore: gt("theme.childThemes.length", MAX_COMPONENTS), click(e) { if (!$(e.target).hasClass("others-count")) { diff --git a/app/assets/javascripts/admin/components/themes-list.js.es6 b/app/assets/javascripts/admin/components/themes-list.js.es6 index ec66ce5c4ff..357e4f756c5 100644 --- a/app/assets/javascripts/admin/components/themes-list.js.es6 +++ b/app/assets/javascripts/admin/components/themes-list.js.es6 @@ -1,3 +1,4 @@ +import { gt, equal } from "@ember/object/computed"; import Component from "@ember/component"; import { THEMES, COMPONENTS } from "admin/models/theme"; import { default as computed } from "ember-addons/ember-computed-decorators"; @@ -8,12 +9,12 @@ export default Component.extend({ classNames: ["themes-list"], - hasThemes: Ember.computed.gt("themesList.length", 0), - hasActiveThemes: Ember.computed.gt("activeThemes.length", 0), - hasInactiveThemes: Ember.computed.gt("inactiveThemes.length", 0), + hasThemes: gt("themesList.length", 0), + hasActiveThemes: gt("activeThemes.length", 0), + hasInactiveThemes: gt("inactiveThemes.length", 0), - themesTabActive: Ember.computed.equal("currentTab", THEMES), - componentsTabActive: Ember.computed.equal("currentTab", COMPONENTS), + themesTabActive: equal("currentTab", THEMES), + componentsTabActive: equal("currentTab", COMPONENTS), @computed("themes", "components", "currentTab") themesList(themes, components) { diff --git a/app/assets/javascripts/admin/components/value-list.js.es6 b/app/assets/javascripts/admin/components/value-list.js.es6 index 8a1fa5baa10..aa21a2f48b0 100644 --- a/app/assets/javascripts/admin/components/value-list.js.es6 +++ b/app/assets/javascripts/admin/components/value-list.js.es6 @@ -1,3 +1,4 @@ +import { empty, alias } from "@ember/object/computed"; import Component from "@ember/component"; import { on } 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({ classNameBindings: [":value-list"], - inputInvalid: Ember.computed.empty("newValue"), + inputInvalid: empty("newValue"), inputDelimiter: null, inputType: null, newValue: "", collection: null, values: null, - noneKey: Ember.computed.alias("addKey"), + noneKey: alias("addKey"), @on("didReceiveAttrs") _setupCollection() { diff --git a/app/assets/javascripts/admin/components/watched-word-uploader.js.es6 b/app/assets/javascripts/admin/components/watched-word-uploader.js.es6 index b38d8c26068..417f3d5bbf5 100644 --- a/app/assets/javascripts/admin/components/watched-word-uploader.js.es6 +++ b/app/assets/javascripts/admin/components/watched-word-uploader.js.es6 @@ -1,3 +1,4 @@ +import { alias } from "@ember/object/computed"; import Component from "@ember/component"; import computed from "ember-addons/ember-computed-decorators"; import UploadMixin from "discourse/mixins/upload"; @@ -6,7 +7,7 @@ export default Component.extend(UploadMixin, { type: "txt", classNames: "watched-words-uploader", uploadUrl: "/admin/logs/watched_words/upload", - addDisabled: Ember.computed.alias("uploading"), + addDisabled: alias("uploading"), validateUploadedFilesOptions() { return { skipValidation: true }; diff --git a/app/assets/javascripts/admin/controllers/admin-backups-index.js.es6 b/app/assets/javascripts/admin/controllers/admin-backups-index.js.es6 index 6c7249c3f9b..6b69eaea72f 100644 --- a/app/assets/javascripts/admin/controllers/admin-backups-index.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-backups-index.js.es6 @@ -1,3 +1,4 @@ +import { alias, equal } from "@ember/object/computed"; import { inject } from "@ember/controller"; import Controller from "@ember/controller"; import { ajax } from "discourse/lib/ajax"; @@ -6,10 +7,10 @@ import { setting, i18n } from "discourse/lib/computed"; export default Controller.extend({ adminBackups: inject(), - status: Ember.computed.alias("adminBackups.model"), + status: alias("adminBackups.model"), uploadLabel: i18n("admin.backups.upload.label"), backupLocation: setting("backup_location"), - localBackupStorage: Ember.computed.equal("backupLocation", "local"), + localBackupStorage: equal("backupLocation", "local"), @computed("status.allowRestore", "status.isOperationRunning") restoreTitle(allowRestore, isOperationRunning) { diff --git a/app/assets/javascripts/admin/controllers/admin-backups-logs.js.es6 b/app/assets/javascripts/admin/controllers/admin-backups-logs.js.es6 index 156d6f2f2a1..a32e2162553 100644 --- a/app/assets/javascripts/admin/controllers/admin-backups-logs.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-backups-logs.js.es6 @@ -1,8 +1,9 @@ +import { alias } from "@ember/object/computed"; import { inject } from "@ember/controller"; import Controller from "@ember/controller"; export default Controller.extend({ adminBackups: inject(), - status: Ember.computed.alias("adminBackups.model"), + status: alias("adminBackups.model"), init() { this._super(...arguments); diff --git a/app/assets/javascripts/admin/controllers/admin-backups.js.es6 b/app/assets/javascripts/admin/controllers/admin-backups.js.es6 index d697ae72887..7e942d9e9ca 100644 --- a/app/assets/javascripts/admin/controllers/admin-backups.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-backups.js.es6 @@ -1,10 +1,11 @@ +import { not, and } from "@ember/object/computed"; import Controller from "@ember/controller"; export default Controller.extend({ - noOperationIsRunning: Ember.computed.not("model.isOperationRunning"), - rollbackEnabled: Ember.computed.and( + noOperationIsRunning: not("model.isOperationRunning"), + rollbackEnabled: and( "model.canRollback", "model.restoreEnabled", "noOperationIsRunning" ), - rollbackDisabled: Ember.computed.not("rollbackEnabled") + rollbackDisabled: not("rollbackEnabled") }); diff --git a/app/assets/javascripts/admin/controllers/admin-badges-show.js.es6 b/app/assets/javascripts/admin/controllers/admin-badges-show.js.es6 index e432a9fbcaf..ddef8ce8a04 100644 --- a/app/assets/javascripts/admin/controllers/admin-badges-show.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-badges-show.js.es6 @@ -1,3 +1,4 @@ +import { alias } from "@ember/object/computed"; import { inject } from "@ember/controller"; import Controller from "@ember/controller"; import { popupAjaxError } from "discourse/lib/ajax-error"; @@ -10,14 +11,14 @@ export default Controller.extend(bufferedProperty("model"), { saving: false, savingStatus: "", - badgeTypes: Ember.computed.alias("adminBadges.badgeTypes"), - badgeGroupings: Ember.computed.alias("adminBadges.badgeGroupings"), - badgeTriggers: Ember.computed.alias("adminBadges.badgeTriggers"), - protectedSystemFields: Ember.computed.alias( + badgeTypes: alias("adminBadges.badgeTypes"), + badgeGroupings: alias("adminBadges.badgeGroupings"), + badgeTriggers: alias("adminBadges.badgeTriggers"), + protectedSystemFields: alias( "adminBadges.protectedSystemFields" ), - readOnly: Ember.computed.alias("buffered.system"), + readOnly: alias("buffered.system"), showDisplayName: propertyNotEqual("name", "displayName"), @computed("model.query", "buffered.query") diff --git a/app/assets/javascripts/admin/controllers/admin-customize-email-templates.js.es6 b/app/assets/javascripts/admin/controllers/admin-customize-email-templates.js.es6 index 253641fc12a..2f85e8418de 100644 --- a/app/assets/javascripts/admin/controllers/admin-customize-email-templates.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-customize-email-templates.js.es6 @@ -1,7 +1,8 @@ +import { sort } from "@ember/object/computed"; import Controller from "@ember/controller"; export default Controller.extend({ emailTemplates: null, - sortedTemplates: Ember.computed.sort("emailTemplates", "titleSorting"), + sortedTemplates: sort("emailTemplates", "titleSorting"), init() { this._super(...arguments); diff --git a/app/assets/javascripts/admin/controllers/admin-customize-robots-txt.js.es6 b/app/assets/javascripts/admin/controllers/admin-customize-robots-txt.js.es6 index 61b0b6269b2..5c6d2499f4c 100644 --- a/app/assets/javascripts/admin/controllers/admin-customize-robots-txt.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-customize-robots-txt.js.es6 @@ -1,3 +1,4 @@ +import { not } from "@ember/object/computed"; import Controller from "@ember/controller"; import { ajax } from "discourse/lib/ajax"; import { bufferedProperty } from "discourse/mixins/buffered-content"; @@ -7,7 +8,7 @@ export default Controller.extend(bufferedProperty("model"), { saved: false, isSaving: false, saveDisabled: propertyEqual("model.robots_txt", "buffered.robots_txt"), - resetDisbaled: Ember.computed.not("model.overridden"), + resetDisbaled: not("model.overridden"), actions: { save() { diff --git a/app/assets/javascripts/admin/controllers/admin-customize-themes-show.js.es6 b/app/assets/javascripts/admin/controllers/admin-customize-themes-show.js.es6 index 6b9c26601fe..bb12b4e12bf 100644 --- a/app/assets/javascripts/admin/controllers/admin-customize-themes-show.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-customize-themes-show.js.es6 @@ -1,3 +1,4 @@ +import { empty, notEmpty, match } from "@ember/object/computed"; import Controller from "@ember/controller"; import { default as computed } from "ember-addons/ember-computed-decorators"; import { url } from "discourse/lib/computed"; @@ -11,7 +12,7 @@ const THEME_UPLOAD_VAR = 2; export default Controller.extend({ downloadUrl: url("model.id", "/admin/customize/themes/%@/export"), previewUrl: url("model.id", "/admin/themes/%@/preview"), - addButtonDisabled: Ember.computed.empty("selectedChildThemeId"), + addButtonDisabled: empty("selectedChildThemeId"), editRouteName: "adminCustomizeThemes.edit", @computed("model.editedFields") @@ -80,14 +81,14 @@ export default Controller.extend({ return settings.map(setting => ThemeSettings.create(setting)); }, - hasSettings: Ember.computed.notEmpty("settings"), + hasSettings: notEmpty("settings"), @computed("model.translations") translations(translations) { return translations.map(setting => ThemeSettings.create(setting)); }, - hasTranslations: Ember.computed.notEmpty("translations"), + hasTranslations: notEmpty("translations"), @computed("model.remoteError", "updatingRemote") showRemoteError(errorMessage, updating) { @@ -148,7 +149,7 @@ export default Controller.extend({ "scss" ); }, - sourceIsHttp: Ember.computed.match( + sourceIsHttp: match( "model.remote_theme.remote_url", /^http(s)?:\/\// ), diff --git a/app/assets/javascripts/admin/controllers/admin-email-index.js.es6 b/app/assets/javascripts/admin/controllers/admin-email-index.js.es6 index 586c911c3c4..124c364af31 100644 --- a/app/assets/javascripts/admin/controllers/admin-email-index.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-email-index.js.es6 @@ -1,3 +1,4 @@ +import { empty } from "@ember/object/computed"; import Controller from "@ember/controller"; import { ajax } from "discourse/lib/ajax"; export default Controller.extend({ @@ -6,7 +7,7 @@ export default Controller.extend({ @property sendTestEmailDisabled **/ - sendTestEmailDisabled: Ember.computed.empty("testEmailAddress"), + sendTestEmailDisabled: empty("testEmailAddress"), /** Clears the 'sentTestEmail' property on successful send. diff --git a/app/assets/javascripts/admin/controllers/admin-email-preview-digest.js.es6 b/app/assets/javascripts/admin/controllers/admin-email-preview-digest.js.es6 index 648891b5455..66b393196a5 100644 --- a/app/assets/javascripts/admin/controllers/admin-email-preview-digest.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-email-preview-digest.js.es6 @@ -1,3 +1,4 @@ +import { empty, or, notEmpty } from "@ember/object/computed"; import Controller from "@ember/controller"; import EmailPreview from "admin/models/email-preview"; import { popupAjaxError } from "discourse/lib/ajax-error"; @@ -6,10 +7,10 @@ export default Controller.extend({ username: null, lastSeen: null, - emailEmpty: Ember.computed.empty("email"), - sendEmailDisabled: Ember.computed.or("emailEmpty", "sendingEmail"), - showSendEmailForm: Ember.computed.notEmpty("model.html_content"), - htmlEmpty: Ember.computed.empty("model.html_content"), + emailEmpty: empty("email"), + sendEmailDisabled: or("emailEmpty", "sendingEmail"), + showSendEmailForm: notEmpty("model.html_content"), + htmlEmpty: empty("model.html_content"), actions: { refresh() { diff --git a/app/assets/javascripts/admin/controllers/admin-emojis.js.es6 b/app/assets/javascripts/admin/controllers/admin-emojis.js.es6 index f9611b2813b..6a1d295759c 100644 --- a/app/assets/javascripts/admin/controllers/admin-emojis.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-emojis.js.es6 @@ -1,8 +1,9 @@ +import { sort } from "@ember/object/computed"; import EmberObject from "@ember/object"; import Controller from "@ember/controller"; import { ajax } from "discourse/lib/ajax"; export default Controller.extend({ - sortedEmojis: Ember.computed.sort("model", "emojiSorting"), + sortedEmojis: sort("model", "emojiSorting"), init() { this._super(...arguments); diff --git a/app/assets/javascripts/admin/controllers/admin-logs-staff-action-logs.js.es6 b/app/assets/javascripts/admin/controllers/admin-logs-staff-action-logs.js.es6 index 65df52b7f6e..a375379fc08 100644 --- a/app/assets/javascripts/admin/controllers/admin-logs-staff-action-logs.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-logs-staff-action-logs.js.es6 @@ -1,3 +1,4 @@ +import { gt } from "@ember/object/computed"; import EmberObject from "@ember/object"; import { scheduleOnce } from "@ember/runloop"; import Controller from "@ember/controller"; @@ -11,7 +12,7 @@ import { export default Controller.extend({ model: null, filters: null, - filtersExists: Ember.computed.gt("filterCount", 0), + filtersExists: gt("filterCount", 0), userHistoryActions: null, @computed("filters.action_name") diff --git a/app/assets/javascripts/admin/controllers/admin-site-settings.js.es6 b/app/assets/javascripts/admin/controllers/admin-site-settings.js.es6 index c2ae8d5a568..100ff83295b 100644 --- a/app/assets/javascripts/admin/controllers/admin-site-settings.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-site-settings.js.es6 @@ -1,9 +1,10 @@ +import { alias } from "@ember/object/computed"; import Controller from "@ember/controller"; import debounce from "discourse/lib/debounce"; export default Controller.extend({ filter: null, - allSiteSettings: Ember.computed.alias("model"), + allSiteSettings: alias("model"), visibleSiteSettings: null, onlyOverridden: false, diff --git a/app/assets/javascripts/admin/controllers/admin-user-badges.js.es6 b/app/assets/javascripts/admin/controllers/admin-user-badges.js.es6 index eed2c23ec44..fac3436c6e2 100644 --- a/app/assets/javascripts/admin/controllers/admin-user-badges.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-user-badges.js.es6 @@ -1,3 +1,4 @@ +import { alias, sort } from "@ember/object/computed"; import { next } from "@ember/runloop"; import { inject } 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, { adminUser: inject(), - user: Ember.computed.alias("adminUser.model"), - userBadges: Ember.computed.alias("model"), - allBadges: Ember.computed.alias("badges"), - sortedBadges: Ember.computed.sort("model", "badgeSortOrder"), + user: alias("adminUser.model"), + userBadges: alias("model"), + allBadges: alias("badges"), + sortedBadges: sort("model", "badgeSortOrder"), init() { this._super(...arguments); diff --git a/app/assets/javascripts/admin/controllers/admin-user-fields.js.es6 b/app/assets/javascripts/admin/controllers/admin-user-fields.js.es6 index c2c6e9d5fcd..b81b08f559c 100644 --- a/app/assets/javascripts/admin/controllers/admin-user-fields.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-user-fields.js.es6 @@ -1,3 +1,4 @@ +import { gte, sort } from "@ember/object/computed"; import Controller from "@ember/controller"; import { popupAjaxError } from "discourse/lib/ajax-error"; @@ -5,8 +6,8 @@ const MAX_FIELDS = 20; export default Controller.extend({ fieldTypes: null, - createDisabled: Ember.computed.gte("model.length", MAX_FIELDS), - sortedFields: Ember.computed.sort("model", "fieldSortOrder"), + createDisabled: gte("model.length", MAX_FIELDS), + sortedFields: sort("model", "fieldSortOrder"), init() { this._super(...arguments); diff --git a/app/assets/javascripts/admin/controllers/admin-user-index.js.es6 b/app/assets/javascripts/admin/controllers/admin-user-index.js.es6 index 8db8b482a9d..18f5509db74 100644 --- a/app/assets/javascripts/admin/controllers/admin-user-index.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-user-index.js.es6 @@ -1,3 +1,4 @@ +import { notEmpty, and } from "@ember/object/computed"; import { inject as service } from "@ember/service"; import Controller from "@ember/controller"; import { ajax } from "discourse/lib/ajax"; @@ -16,7 +17,7 @@ export default Controller.extend(CanCheckEmails, { userTitleValue: null, showBadges: setting("enable_badges"), - hasLockedTrustLevel: Ember.computed.notEmpty( + hasLockedTrustLevel: notEmpty( "model.manual_locked_trust_level" ), @@ -25,7 +26,7 @@ export default Controller.extend(CanCheckEmails, { "model.primary_group_id" ), - canDisableSecondFactor: Ember.computed.and( + canDisableSecondFactor: and( "model.second_factor_enabled", "model.can_disable_second_factor" ), diff --git a/app/assets/javascripts/admin/controllers/admin-watched-words-action.js.es6 b/app/assets/javascripts/admin/controllers/admin-watched-words-action.js.es6 index 4435eb9b25e..1726446d8c5 100644 --- a/app/assets/javascripts/admin/controllers/admin-watched-words-action.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-watched-words-action.js.es6 @@ -1,3 +1,4 @@ +import { or } from "@ember/object/computed"; import { schedule } from "@ember/runloop"; import { inject } from "@ember/controller"; import Controller from "@ember/controller"; @@ -10,7 +11,7 @@ import showModal from "discourse/lib/show-modal"; export default Controller.extend({ actionNameKey: null, adminWatchedWords: inject(), - showWordsList: Ember.computed.or( + showWordsList: or( "adminWatchedWords.filtered", "adminWatchedWords.showWords" ), diff --git a/app/assets/javascripts/admin/controllers/admin-watched-words.js.es6 b/app/assets/javascripts/admin/controllers/admin-watched-words.js.es6 index 5d52d67a360..db269043ee9 100644 --- a/app/assets/javascripts/admin/controllers/admin-watched-words.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-watched-words.js.es6 @@ -1,3 +1,4 @@ +import { alias } from "@ember/object/computed"; import EmberObject from "@ember/object"; import Controller from "@ember/controller"; import debounce from "discourse/lib/debounce"; @@ -6,7 +7,7 @@ export default Controller.extend({ filter: null, filtered: false, showWords: false, - disableShowWords: Ember.computed.alias("filtered"), + disableShowWords: alias("filtered"), regularExpressions: null, filterContentNow() { diff --git a/app/assets/javascripts/admin/controllers/admin-web-hooks-show-events.js.es6 b/app/assets/javascripts/admin/controllers/admin-web-hooks-show-events.js.es6 index 1f10fa3e08f..e550a79069b 100644 --- a/app/assets/javascripts/admin/controllers/admin-web-hooks-show-events.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-web-hooks-show-events.js.es6 @@ -1,3 +1,4 @@ +import { alias } from "@ember/object/computed"; import Controller from "@ember/controller"; import { ajax } from "discourse/lib/ajax"; import { popupAjaxError } from "discourse/lib/ajax-error"; @@ -5,7 +6,7 @@ import computed from "ember-addons/ember-computed-decorators"; export default Controller.extend({ pingDisabled: false, - incomingCount: Ember.computed.alias("incomingEventIds.length"), + incomingCount: alias("incomingEventIds.length"), init() { this._super(...arguments); diff --git a/app/assets/javascripts/admin/controllers/admin-web-hooks-show.js.es6 b/app/assets/javascripts/admin/controllers/admin-web-hooks-show.js.es6 index 6439e3b9450..0a331bf8cfb 100644 --- a/app/assets/javascripts/admin/controllers/admin-web-hooks-show.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-web-hooks-show.js.es6 @@ -1,3 +1,4 @@ +import { alias } from "@ember/object/computed"; import { inject } from "@ember/controller"; import Controller from "@ember/controller"; import { popupAjaxError } from "discourse/lib/ajax-error"; @@ -7,9 +8,9 @@ import InputValidation from "discourse/models/input-validation"; export default Controller.extend({ adminWebHooks: inject(), - eventTypes: Ember.computed.alias("adminWebHooks.eventTypes"), - defaultEventTypes: Ember.computed.alias("adminWebHooks.defaultEventTypes"), - contentTypes: Ember.computed.alias("adminWebHooks.contentTypes"), + eventTypes: alias("adminWebHooks.eventTypes"), + defaultEventTypes: alias("adminWebHooks.defaultEventTypes"), + contentTypes: alias("adminWebHooks.contentTypes"), @computed showTagsFilter() { diff --git a/app/assets/javascripts/admin/controllers/modals/admin-add-upload.js.es6 b/app/assets/javascripts/admin/controllers/modals/admin-add-upload.js.es6 index aa77b2050e4..3d0abf50374 100644 --- a/app/assets/javascripts/admin/controllers/modals/admin-add-upload.js.es6 +++ b/app/assets/javascripts/admin/controllers/modals/admin-add-upload.js.es6 @@ -1,3 +1,4 @@ +import { and, not } from "@ember/object/computed"; import { inject } from "@ember/controller"; import Controller from "@ember/controller"; import ModalFunctionality from "discourse/mixins/modal-functionality"; @@ -64,8 +65,8 @@ export default Controller.extend(ModalFunctionality, { this.set("fileSelected", false); }, - enabled: Ember.computed.and("nameValid", "fileSelected"), - disabled: Ember.computed.not("enabled"), + enabled: and("nameValid", "fileSelected"), + disabled: not("enabled"), @computed("name", "adminCustomizeThemesShow.model.theme_fields") errorMessage(name, themeFields) { diff --git a/app/assets/javascripts/admin/controllers/modals/admin-badge-preview.js.es6 b/app/assets/javascripts/admin/controllers/modals/admin-badge-preview.js.es6 index bf58496ed7b..b6419c8e04d 100644 --- a/app/assets/javascripts/admin/controllers/modals/admin-badge-preview.js.es6 +++ b/app/assets/javascripts/admin/controllers/modals/admin-badge-preview.js.es6 @@ -1,11 +1,12 @@ +import { alias, map } from "@ember/object/computed"; import Controller from "@ember/controller"; import { default as computed } from "ember-addons/ember-computed-decorators"; import { escapeExpression } from "discourse/lib/utilities"; export default Controller.extend({ - sample: Ember.computed.alias("model.sample"), - errors: Ember.computed.alias("model.errors"), - count: Ember.computed.alias("model.grant_count"), + sample: alias("model.sample"), + errors: alias("model.errors"), + count: alias("model.grant_count"), @computed("count", "sample.length") countWarning(count, sampleLength) { @@ -34,7 +35,7 @@ export default Controller.extend({ return output; }, - processedSample: Ember.computed.map("model.sample", grant => { + processedSample: map("model.sample", grant => { let i18nKey = "admin.badges.preview.grant.with"; const i18nParams = { username: escapeExpression(grant.username) }; diff --git a/app/assets/javascripts/admin/controllers/modals/admin-install-theme.js.es6 b/app/assets/javascripts/admin/controllers/modals/admin-install-theme.js.es6 index 58137f6672b..949353de7d8 100644 --- a/app/assets/javascripts/admin/controllers/modals/admin-install-theme.js.es6 +++ b/app/assets/javascripts/admin/controllers/modals/admin-install-theme.js.es6 @@ -1,3 +1,4 @@ +import { equal, match, alias } from "@ember/object/computed"; import { inject } from "@ember/controller"; import Controller from "@ember/controller"; 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; export default Controller.extend(ModalFunctionality, { - popular: Ember.computed.equal("selection", "popular"), - local: Ember.computed.equal("selection", "local"), - remote: Ember.computed.equal("selection", "remote"), - create: Ember.computed.equal("selection", "create"), + popular: equal("selection", "popular"), + local: equal("selection", "local"), + remote: equal("selection", "remote"), + create: equal("selection", "create"), selection: "popular", adminCustomizeThemes: inject(), loading: false, keyGenUrl: "/admin/themes/generate_key_pair", importUrl: "/admin/themes/import", recordType: "theme", - checkPrivate: Ember.computed.match("uploadUrl", /^git/), + checkPrivate: match("uploadUrl", /^git/), localFile: null, uploadUrl: null, urlPlaceholder: "https://github.com/discourse/sample_theme", advancedVisible: false, themesController: inject("adminCustomizeThemes"), - selectedType: Ember.computed.alias("themesController.currentTab"), - component: Ember.computed.equal("selectedType", COMPONENTS), + selectedType: alias("themesController.currentTab"), + component: equal("selectedType", COMPONENTS), init() { this._super(...arguments); diff --git a/app/assets/javascripts/admin/mixins/setting-component.js.es6 b/app/assets/javascripts/admin/mixins/setting-component.js.es6 index 09b3b4ce7b9..e90a10d37cd 100644 --- a/app/assets/javascripts/admin/mixins/setting-component.js.es6 +++ b/app/assets/javascripts/admin/mixins/setting-component.js.es6 @@ -1,3 +1,4 @@ +import { alias, oneWay } from "@ember/object/computed"; import computed from "ember-addons/ember-computed-decorators"; import { categoryLinkHTML } from "discourse/helpers/category-link"; import Mixin from "@ember/object/mixin"; @@ -22,9 +23,9 @@ const AUTO_REFRESH_ON_SAVE = ["logo", "logo_small", "large_icon"]; export default Mixin.create({ classNameBindings: [":row", ":setting", "overridden", "typeClass"], - content: Ember.computed.alias("setting"), + content: alias("setting"), validationMessage: null, - isSecret: Ember.computed.oneWay("setting.secret"), + isSecret: oneWay("setting.secret"), @computed("buffered.value", "setting.value") dirty(bufferVal, settingVal) { diff --git a/app/assets/javascripts/admin/models/admin-user.js.es6 b/app/assets/javascripts/admin/models/admin-user.js.es6 index 8a8ba624810..a33bac5e03a 100644 --- a/app/assets/javascripts/admin/models/admin-user.js.es6 +++ b/app/assets/javascripts/admin/models/admin-user.js.es6 @@ -1,3 +1,4 @@ +import { filter, or, gt, lt, not } from "@ember/object/computed"; import { iconHTML } from "discourse-common/lib/icon-library"; import { ajax } from "discourse/lib/ajax"; 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({ adminUserView: true, - customGroups: Ember.computed.filter( + customGroups: filter( "groups", g => !g.automatic && Group.create(g) ), - automaticGroups: Ember.computed.filter( + automaticGroups: filter( "groups", g => g.automatic && Group.create(g) ), - canViewProfile: Ember.computed.or("active", "staged"), + canViewProfile: or("active", "staged"), @computed("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"); }, - canResetBounceScore: Ember.computed.gt("bounce_score", 0), + canResetBounceScore: gt("bounce_score", 0), resetBounceScore() { 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") suspendDuration(suspendedTill, suspendedAt) { @@ -557,9 +558,9 @@ AdminUser.reopenClass({ }); }, - findAll(query, filter) { + findAll(query, userFilter) { return ajax(`/admin/users/list/${query}.json`, { - data: filter + data: userFilter }).then(users => users.map(u => AdminUser.create(u))); } }); diff --git a/app/assets/javascripts/admin/models/backup-status.js.es6 b/app/assets/javascripts/admin/models/backup-status.js.es6 index 2eb856c3be7..b7deec1c10b 100644 --- a/app/assets/javascripts/admin/models/backup-status.js.es6 +++ b/app/assets/javascripts/admin/models/backup-status.js.es6 @@ -1,7 +1,8 @@ +import { not } from "@ember/object/computed"; import computed from "ember-addons/ember-computed-decorators"; export default Discourse.Model.extend({ - restoreDisabled: Ember.computed.not("restoreEnabled"), + restoreDisabled: not("restoreEnabled"), @computed("allowRestore", "isOperationRunning") restoreEnabled(allowRestore, isOperationRunning) { diff --git a/app/assets/javascripts/admin/models/color-scheme.js.es6 b/app/assets/javascripts/admin/models/color-scheme.js.es6 index 26c8ccdc0ed..8875bf2e5e4 100644 --- a/app/assets/javascripts/admin/models/color-scheme.js.es6 +++ b/app/assets/javascripts/admin/models/color-scheme.js.es6 @@ -1,3 +1,4 @@ +import { not } from "@ember/object/computed"; import { ajax } from "discourse/lib/ajax"; import ColorSchemeColor from "admin/models/color-scheme-color"; 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")); }, - newRecord: Ember.computed.not("id"), + newRecord: not("id"), save(opts) { if (this.is_base || this.disableSave) return; diff --git a/app/assets/javascripts/admin/models/screened-ip-address.js.es6 b/app/assets/javascripts/admin/models/screened-ip-address.js.es6 index c7f3863738c..0449a666f37 100644 --- a/app/assets/javascripts/admin/models/screened-ip-address.js.es6 +++ b/app/assets/javascripts/admin/models/screened-ip-address.js.es6 @@ -1,3 +1,4 @@ +import { equal } from "@ember/object/computed"; import { ajax } from "discourse/lib/ajax"; 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}`); }, - isBlocked: Ember.computed.equal("action_name", "block"), + isBlocked: equal("action_name", "block"), @computed("ip_address") isRange(ipAddress) { diff --git a/app/assets/javascripts/admin/models/theme.js.es6 b/app/assets/javascripts/admin/models/theme.js.es6 index 7e49ff9b9e8..b0c5f4729ef 100644 --- a/app/assets/javascripts/admin/models/theme.js.es6 +++ b/app/assets/javascripts/admin/models/theme.js.es6 @@ -1,3 +1,4 @@ +import { or, gt } from "@ember/object/computed"; import RestModel from "discourse/models/rest"; import { default as computed } from "ember-addons/ember-computed-decorators"; import { popupAjaxError } from "discourse/lib/ajax-error"; @@ -13,9 +14,9 @@ export const COMPONENTS = "components"; const SETTINGS_TYPE_ID = 5; const Theme = RestModel.extend({ - isActive: Ember.computed.or("default", "user_selectable"), - isPendingUpdates: Ember.computed.gt("remote_theme.commits_behind", 0), - hasEditedFields: Ember.computed.gt("editedFields.length", 0), + isActive: or("default", "user_selectable"), + isPendingUpdates: gt("remote_theme.commits_behind", 0), + hasEditedFields: gt("editedFields.length", 0), @computed("theme_fields.[]") targets() { diff --git a/app/assets/javascripts/discourse-loader.js b/app/assets/javascripts/discourse-loader.js index cb83e8aa4ec..0cda325c306 100644 --- a/app/assets/javascripts/discourse-loader.js +++ b/app/assets/javascripts/discourse-loader.js @@ -12,6 +12,41 @@ var define, requirejs; inject: Ember.inject.controller }, "@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/proxy": { default: Ember.ObjectProxy }, "@ember/routing/route": { default: Ember.Route }, diff --git a/app/assets/javascripts/discourse/components/badge-button.js.es6 b/app/assets/javascripts/discourse/components/badge-button.js.es6 index 1861788a02d..dde5bfb804b 100644 --- a/app/assets/javascripts/discourse/components/badge-button.js.es6 +++ b/app/assets/javascripts/discourse/components/badge-button.js.es6 @@ -1,3 +1,4 @@ +import { alias } from "@ember/object/computed"; import Component from "@ember/component"; import computed from "ember-addons/ember-computed-decorators"; @@ -15,5 +16,5 @@ export default Component.extend({ }, attributeBindings: ["data-badge-name", "title"], - "data-badge-name": Ember.computed.alias("badge.name") + "data-badge-name": alias("badge.name") }); diff --git a/app/assets/javascripts/discourse/components/basic-topic-list.js.es6 b/app/assets/javascripts/discourse/components/basic-topic-list.js.es6 index f4bc6eb49c9..64942198ed4 100644 --- a/app/assets/javascripts/discourse/components/basic-topic-list.js.es6 +++ b/app/assets/javascripts/discourse/components/basic-topic-list.js.es6 @@ -1,9 +1,10 @@ +import { alias, not } from "@ember/object/computed"; import Component from "@ember/component"; import computed from "ember-addons/ember-computed-decorators"; export default Component.extend({ - loadingMore: Ember.computed.alias("topicList.loadingMore"), - loading: Ember.computed.not("loaded"), + loadingMore: alias("topicList.loadingMore"), + loading: not("loaded"), @computed("topicList.loaded") loaded() { diff --git a/app/assets/javascripts/discourse/components/bread-crumbs.js.es6 b/app/assets/javascripts/discourse/components/bread-crumbs.js.es6 index 21992f108bd..e420fcce7cd 100644 --- a/app/assets/javascripts/discourse/components/bread-crumbs.js.es6 +++ b/app/assets/javascripts/discourse/components/bread-crumbs.js.es6 @@ -1,3 +1,4 @@ +import { alias, filter, or } from "@ember/object/computed"; import Component from "@ember/component"; import { default as computed } from "ember-addons/ember-computed-decorators"; @@ -6,9 +7,9 @@ export default Component.extend({ classNameBindings: ["hidden:hidden", ":category-breadcrumb"], 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 ( c.id === this.site.get("uncategorized_category_id") && !this.siteSettings.allow_uncategorized_topics @@ -34,7 +35,7 @@ export default Component.extend({ return this.site.mobileView && !category; }, - firstCategory: Ember.computed.or("{parentCategory,category}"), + firstCategory: or("{parentCategory,category}"), @computed("category", "parentCategory") secondCategory(category, parentCategory) { diff --git a/app/assets/javascripts/discourse/components/composer-action-title.js.es6 b/app/assets/javascripts/discourse/components/composer-action-title.js.es6 index 6b86bb39c6c..8e4fd6c9f72 100644 --- a/app/assets/javascripts/discourse/components/composer-action-title.js.es6 +++ b/app/assets/javascripts/discourse/components/composer-action-title.js.es6 @@ -1,3 +1,4 @@ +import { alias, equal } from "@ember/object/computed"; import Component from "@ember/component"; import { default as computed } from "ember-addons/ember-computed-decorators"; import { @@ -19,9 +20,9 @@ const TITLES = { export default Component.extend({ classNames: ["composer-action-title"], - options: Ember.computed.alias("model.replyOptions"), - action: Ember.computed.alias("model.action"), - isEditing: Ember.computed.equal("action", EDIT), + options: alias("model.replyOptions"), + action: alias("model.action"), + isEditing: equal("action", EDIT), @computed("options", "action") actionTitle(opts, action) { diff --git a/app/assets/javascripts/discourse/components/composer-messages.js.es6 b/app/assets/javascripts/discourse/components/composer-messages.js.es6 index 82a4fceeaf8..e9860973a2a 100644 --- a/app/assets/javascripts/discourse/components/composer-messages.js.es6 +++ b/app/assets/javascripts/discourse/components/composer-messages.js.es6 @@ -1,3 +1,4 @@ +import { not } from "@ember/object/computed"; import EmberObject from "@ember/object"; import { scheduleOnce } from "@ember/runloop"; import Component from "@ember/component"; @@ -16,7 +17,7 @@ export default Component.extend({ _yourselfConfirm: null, similarTopics: null, - hidden: Ember.computed.not("composer.viewOpenOrFullscreen"), + hidden: not("composer.viewOpenOrFullscreen"), didInsertElement() { this._super(...arguments); diff --git a/app/assets/javascripts/discourse/components/composer-title.js.es6 b/app/assets/javascripts/discourse/components/composer-title.js.es6 index 540f1b36eb1..907a4569db3 100644 --- a/app/assets/javascripts/discourse/components/composer-title.js.es6 +++ b/app/assets/javascripts/discourse/components/composer-title.js.es6 @@ -1,3 +1,4 @@ +import { alias, or } from "@ember/object/computed"; import { next } from "@ember/runloop"; import { debounce } from "@ember/runloop"; import { schedule } from "@ember/runloop"; @@ -13,8 +14,8 @@ import afterTransition from "discourse/lib/after-transition"; export default Component.extend({ classNames: ["title-input"], - watchForLink: Ember.computed.alias("composer.canEditTopicFeaturedLink"), - disabled: Ember.computed.or("composer.loading", "composer.disableTitleInput"), + watchForLink: alias("composer.canEditTopicFeaturedLink"), + disabled: or("composer.loading", "composer.disableTitleInput"), didInsertElement() { this._super(...arguments); diff --git a/app/assets/javascripts/discourse/components/create-topics-notice.js.es6 b/app/assets/javascripts/discourse/components/create-topics-notice.js.es6 index a5a20ac69a3..96c29f90815 100644 --- a/app/assets/javascripts/discourse/components/create-topics-notice.js.es6 +++ b/app/assets/javascripts/discourse/components/create-topics-notice.js.es6 @@ -1,3 +1,4 @@ +import { alias } from "@ember/object/computed"; import Component from "@ember/component"; import computed from "ember-addons/ember-computed-decorators"; import { observes } from "ember-addons/ember-computed-decorators"; @@ -12,7 +13,7 @@ export default Component.extend({ publicPostCount: null, requiredTopics: 5, - requiredPosts: Ember.computed.alias("siteSettings.tl1_requires_read_posts"), + requiredPosts: alias("siteSettings.tl1_requires_read_posts"), init() { this._super(...arguments); diff --git a/app/assets/javascripts/discourse/components/d-button.js.es6 b/app/assets/javascripts/discourse/components/d-button.js.es6 index b8ca7343cd5..f82df037b7b 100644 --- a/app/assets/javascripts/discourse/components/d-button.js.es6 +++ b/app/assets/javascripts/discourse/components/d-button.js.es6 @@ -1,3 +1,4 @@ +import { notEmpty, empty } from "@ember/object/computed"; import Component from "@ember/component"; import { default as computed } from "ember-addons/ember-computed-decorators"; import DiscourseURL from "discourse/lib/url"; @@ -21,7 +22,7 @@ export default Component.extend({ "type" ], - btnIcon: Ember.computed.notEmpty("icon"), + btnIcon: notEmpty("icon"), @computed("icon", "translatedLabel") btnType(icon, translatedLabel) { @@ -32,7 +33,7 @@ export default Component.extend({ } }, - noText: Ember.computed.empty("translatedLabel"), + noText: empty("translatedLabel"), @computed("title") translatedTitle: { diff --git a/app/assets/javascripts/discourse/components/date-time-input-range.js.es6 b/app/assets/javascripts/discourse/components/date-time-input-range.js.es6 index b86b2a3a12c..ec048ec730d 100644 --- a/app/assets/javascripts/discourse/components/date-time-input-range.js.es6 +++ b/app/assets/javascripts/discourse/components/date-time-input-range.js.es6 @@ -1,3 +1,4 @@ +import { equal } from "@ember/object/computed"; import Component from "@ember/component"; export default Component.extend({ classNames: ["d-date-time-input-range"], @@ -11,8 +12,8 @@ export default Component.extend({ showToTime: true, error: null, - fromPanelActive: Ember.computed.equal("currentPanel", "from"), - toPanelActive: Ember.computed.equal("currentPanel", "to"), + fromPanelActive: equal("currentPanel", "from"), + toPanelActive: equal("currentPanel", "to"), _valid(state) { if (state.to < state.from) { diff --git a/app/assets/javascripts/discourse/components/desktop-notification-config.js.es6 b/app/assets/javascripts/discourse/components/desktop-notification-config.js.es6 index 0df39dce255..112723ba129 100644 --- a/app/assets/javascripts/discourse/components/desktop-notification-config.js.es6 +++ b/app/assets/javascripts/discourse/components/desktop-notification-config.js.es6 @@ -1,3 +1,4 @@ +import { or } from "@ember/object/computed"; import Component from "@ember/component"; import computed from "ember-addons/ember-computed-decorators"; 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() { if (!this.site.mobileView) { diff --git a/app/assets/javascripts/discourse/components/discourse-topic.js.es6 b/app/assets/javascripts/discourse/components/discourse-topic.js.es6 index 796e0a90683..c9484f62645 100644 --- a/app/assets/javascripts/discourse/components/discourse-topic.js.es6 +++ b/app/assets/javascripts/discourse/components/discourse-topic.js.es6 @@ -1,3 +1,4 @@ +import { alias } from "@ember/object/computed"; import { throttle } from "@ember/runloop"; import { schedule } from "@ember/runloop"; import { scheduleOnce } from "@ember/runloop"; @@ -24,7 +25,7 @@ export default Component.extend( Scrolling, MobileScrollDirection, { - userFilters: Ember.computed.alias("topic.userFilters"), + userFilters: alias("topic.userFilters"), classNameBindings: [ "multiSelect", "topic.archetype", @@ -37,8 +38,8 @@ export default Component.extend( menuVisible: true, SHORT_POST: 1200, - postStream: Ember.computed.alias("topic.postStream"), - archetype: Ember.computed.alias("topic.archetype"), + postStream: alias("topic.postStream"), + archetype: alias("topic.archetype"), dockAt: 0, _lastShowTopic: null, diff --git a/app/assets/javascripts/discourse/components/edit-category-general.js.es6 b/app/assets/javascripts/discourse/components/edit-category-general.js.es6 index 9988120e59b..80d31ef4f28 100644 --- a/app/assets/javascripts/discourse/components/edit-category-general.js.es6 +++ b/app/assets/javascripts/discourse/components/edit-category-general.js.es6 @@ -1,3 +1,4 @@ +import { not } from "@ember/object/computed"; import { buildCategoryPanel } from "discourse/components/edit-category-panel"; import { categoryBadgeHTML } from "discourse/helpers/category-link"; import Category from "discourse/models/category"; @@ -10,7 +11,7 @@ export default buildCategoryPanel("general", { this.foregroundColors = ["FFFFFF", "000000"]; }, - canSelectParentCategory: Ember.computed.not( + canSelectParentCategory: not( "category.isUncategorizedCategory" ), uncategorizedSiteSettingLink: Discourse.getURL( diff --git a/app/assets/javascripts/discourse/components/edit-category-panel.js.es6 b/app/assets/javascripts/discourse/components/edit-category-panel.js.es6 index bd2fe0661f9..3161e31f359 100644 --- a/app/assets/javascripts/discourse/components/edit-category-panel.js.es6 +++ b/app/assets/javascripts/discourse/components/edit-category-panel.js.es6 @@ -1,3 +1,4 @@ +import { equal } from "@ember/object/computed"; import Component from "@ember/component"; const EditCategoryPanel = Component.extend({}); @@ -6,7 +7,7 @@ export default EditCategoryPanel; export function buildCategoryPanel(tab, extras) { return EditCategoryPanel.extend( { - activeTab: Ember.computed.equal("selectedTab", tab), + activeTab: equal("selectedTab", tab), classNameBindings: [ ":modal-tab", "activeTab::hide", diff --git a/app/assets/javascripts/discourse/components/edit-category-settings.js.es6 b/app/assets/javascripts/discourse/components/edit-category-settings.js.es6 index c32f8b0553d..5d692cc6ebf 100644 --- a/app/assets/javascripts/discourse/components/edit-category-settings.js.es6 +++ b/app/assets/javascripts/discourse/components/edit-category-settings.js.es6 @@ -1,3 +1,4 @@ +import { empty, and } from "@ember/object/computed"; import { setting } from "discourse/lib/computed"; import { buildCategoryPanel } from "discourse/components/edit-category-panel"; import computed from "ember-addons/ember-computed-decorators"; @@ -12,12 +13,12 @@ export function addCategorySortCriteria(criteria) { export default buildCategoryPanel("settings", { emailInEnabled: setting("email_in"), showPositionInput: setting("fixed_category_positions"), - isParentCategory: Ember.computed.empty("category.parent_category_id"), - showSubcategoryListStyle: Ember.computed.and( + isParentCategory: empty("category.parent_category_id"), + showSubcategoryListStyle: and( "category.show_subcategory_list", "isParentCategory" ), - isDefaultSortOrder: Ember.computed.empty("category.sort_order"), + isDefaultSortOrder: empty("category.sort_order"), @computed availableSubcategoryListStyles() { diff --git a/app/assets/javascripts/discourse/components/edit-category-tags.js.es6 b/app/assets/javascripts/discourse/components/edit-category-tags.js.es6 index 665975cf6b5..700706ea1c2 100644 --- a/app/assets/javascripts/discourse/components/edit-category-tags.js.es6 +++ b/app/assets/javascripts/discourse/components/edit-category-tags.js.es6 @@ -1,9 +1,10 @@ +import { empty, and } from "@ember/object/computed"; import { buildCategoryPanel } from "discourse/components/edit-category-panel"; export default buildCategoryPanel("tags", { - allowedTagsEmpty: Ember.computed.empty("category.allowed_tags"), - allowedTagGroupsEmpty: Ember.computed.empty("category.allowed_tag_groups"), - disableAllowGlobalTags: Ember.computed.and( + allowedTagsEmpty: empty("category.allowed_tags"), + allowedTagGroupsEmpty: empty("category.allowed_tag_groups"), + disableAllowGlobalTags: and( "allowedTagsEmpty", "allowedTagGroupsEmpty" ) diff --git a/app/assets/javascripts/discourse/components/edit-topic-timer-form.js.es6 b/app/assets/javascripts/discourse/components/edit-topic-timer-form.js.es6 index c46af80e2f6..6d0eccc99a1 100644 --- a/app/assets/javascripts/discourse/components/edit-topic-timer-form.js.es6 +++ b/app/assets/javascripts/discourse/components/edit-topic-timer-form.js.es6 @@ -1,3 +1,4 @@ +import { alias, equal, or } from "@ember/object/computed"; import { schedule } from "@ember/runloop"; import Component from "@ember/component"; import { @@ -16,17 +17,17 @@ import { } from "discourse/controllers/edit-topic-timer"; export default Component.extend({ - selection: Ember.computed.alias("topicTimer.status_type"), - autoOpen: Ember.computed.equal("selection", OPEN_STATUS_TYPE), - autoClose: Ember.computed.equal("selection", CLOSE_STATUS_TYPE), - autoDelete: Ember.computed.equal("selection", DELETE_STATUS_TYPE), - autoBump: Ember.computed.equal("selection", BUMP_TYPE), - publishToCategory: Ember.computed.equal( + selection: alias("topicTimer.status_type"), + autoOpen: equal("selection", OPEN_STATUS_TYPE), + autoClose: equal("selection", CLOSE_STATUS_TYPE), + autoDelete: equal("selection", DELETE_STATUS_TYPE), + autoBump: equal("selection", BUMP_TYPE), + publishToCategory: equal( "selection", PUBLISH_TO_CATEGORY_STATUS_TYPE ), - reminder: Ember.computed.equal("selection", REMINDER_TYPE), - showTimeOnly: Ember.computed.or( + reminder: equal("selection", REMINDER_TYPE), + showTimeOnly: or( "autoOpen", "autoDelete", "reminder", diff --git a/app/assets/javascripts/discourse/components/emoji-uploader.js.es6 b/app/assets/javascripts/discourse/components/emoji-uploader.js.es6 index d118b904c53..37dfd5ea10e 100644 --- a/app/assets/javascripts/discourse/components/emoji-uploader.js.es6 +++ b/app/assets/javascripts/discourse/components/emoji-uploader.js.es6 @@ -1,3 +1,4 @@ +import { notEmpty, not } from "@ember/object/computed"; import Component from "@ember/component"; import { default as computed } from "ember-addons/ember-computed-decorators"; import UploadMixin from "discourse/mixins/upload"; @@ -5,8 +6,8 @@ import UploadMixin from "discourse/mixins/upload"; export default Component.extend(UploadMixin, { type: "emoji", uploadUrl: "/admin/customize/emojis", - hasName: Ember.computed.notEmpty("name"), - addDisabled: Ember.computed.not("hasName"), + hasName: notEmpty("name"), + addDisabled: not("hasName"), uploadOptions() { return { diff --git a/app/assets/javascripts/discourse/components/flag-action-type.js.es6 b/app/assets/javascripts/discourse/components/flag-action-type.js.es6 index 3434ec29547..c42818914d4 100644 --- a/app/assets/javascripts/discourse/components/flag-action-type.js.es6 +++ b/app/assets/javascripts/discourse/components/flag-action-type.js.es6 @@ -1,3 +1,4 @@ +import { and, not, equal } from "@ember/object/computed"; import Component from "@ember/component"; import { MAX_MESSAGE_LENGTH } from "discourse/models/post-action-type"; import computed from "ember-addons/ember-computed-decorators"; @@ -24,9 +25,9 @@ export default Component.extend({ return flag === selectedFlag; }, - showMessageInput: Ember.computed.and("flag.is_custom_flag", "selected"), - showDescription: Ember.computed.not("showMessageInput"), - isNotifyUser: Ember.computed.equal("flag.name_key", "notify_user"), + showMessageInput: and("flag.is_custom_flag", "selected"), + showDescription: not("showMessageInput"), + isNotifyUser: equal("flag.name_key", "notify_user"), @computed("flag.description", "flag.short_description") description(long_description, short_description) { diff --git a/app/assets/javascripts/discourse/components/future-date-input.js.es6 b/app/assets/javascripts/discourse/components/future-date-input.js.es6 index 903f0886f08..1c627ec234a 100644 --- a/app/assets/javascripts/discourse/components/future-date-input.js.es6 +++ b/app/assets/javascripts/discourse/components/future-date-input.js.es6 @@ -1,3 +1,4 @@ +import { equal, and, empty } from "@ember/object/computed"; import Component from "@ember/component"; import { default as computed, @@ -11,12 +12,12 @@ export default Component.extend({ date: null, time: null, includeDateTime: true, - isCustom: Ember.computed.equal("selection", "pick_date_and_time"), - isBasedOnLastPost: Ember.computed.equal( + isCustom: equal("selection", "pick_date_and_time"), + isBasedOnLastPost: equal( "selection", "set_based_on_last_post" ), - displayDateAndTimePicker: Ember.computed.and("includeDateTime", "isCustom"), + displayDateAndTimePicker: and("includeDateTime", "isCustom"), displayLabel: null, init() { @@ -37,7 +38,7 @@ export default Component.extend({ } }, - timeInputDisabled: Ember.computed.empty("date"), + timeInputDisabled: empty("date"), @observes("date", "time") _updateInput() { diff --git a/app/assets/javascripts/discourse/components/google-search.js.es6 b/app/assets/javascripts/discourse/components/google-search.js.es6 index 8ab1969b624..246e7ab2a31 100644 --- a/app/assets/javascripts/discourse/components/google-search.js.es6 +++ b/app/assets/javascripts/discourse/components/google-search.js.es6 @@ -1,3 +1,4 @@ +import { alias } from "@ember/object/computed"; import Component from "@ember/component"; import computed from "ember-addons/ember-computed-decorators"; @@ -5,7 +6,7 @@ export default Component.extend({ classNames: ["google-search-form"], classNameBindings: ["hidden:hidden"], - hidden: Ember.computed.alias("siteSettings.login_required"), + hidden: alias("siteSettings.login_required"), @computed siteUrl() { diff --git a/app/assets/javascripts/discourse/components/group-card-contents.js.es6 b/app/assets/javascripts/discourse/components/group-card-contents.js.es6 index 37e25cfb1c4..bd6d029e492 100644 --- a/app/assets/javascripts/discourse/components/group-card-contents.js.es6 +++ b/app/assets/javascripts/discourse/components/group-card-contents.js.es6 @@ -1,3 +1,4 @@ +import { alias, match, gt, or } from "@ember/object/computed"; import Component from "@ember/component"; import { setting } from "discourse/lib/computed"; 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"), showBadges: setting("enable_badges"), - postStream: Ember.computed.alias("topic.postStream"), - viewingTopic: Ember.computed.match("currentPath", /^topic\./), + postStream: alias("topic.postStream"), + viewingTopic: match("currentPath", /^topic\./), - showMoreMembers: Ember.computed.gt("moreMembersCount", 0), - hasMembersOrIsMember: Ember.computed.or( + showMoreMembers: gt("moreMembersCount", 0), + hasMembersOrIsMember: or( "group.members", "group.is_group_owner_display", "group.is_group_user" diff --git a/app/assets/javascripts/discourse/components/group-members-input.js.es6 b/app/assets/javascripts/discourse/components/group-members-input.js.es6 index 00c0bb62015..b39049abbfb 100644 --- a/app/assets/javascripts/discourse/components/group-members-input.js.es6 +++ b/app/assets/javascripts/discourse/components/group-members-input.js.es6 @@ -1,3 +1,4 @@ +import { lte } from "@ember/object/computed"; import Component from "@ember/component"; import computed from "ember-addons/ember-computed-decorators"; import { popupAjaxError } from "discourse/lib/ajax-error"; @@ -29,7 +30,7 @@ export default Component.extend({ return !usernames || !(usernames.length > 0); }, - showingFirst: Ember.computed.lte("currentPage", 1), + showingFirst: lte("currentPage", 1), showingLast: propertyEqual("currentPage", "totalPages"), actions: { diff --git a/app/assets/javascripts/discourse/components/groups-form-profile-fields.js.es6 b/app/assets/javascripts/discourse/components/groups-form-profile-fields.js.es6 index bca0af8297f..cff51ffd73d 100644 --- a/app/assets/javascripts/discourse/components/groups-form-profile-fields.js.es6 +++ b/app/assets/javascripts/discourse/components/groups-form-profile-fields.js.es6 @@ -1,3 +1,4 @@ +import { not } from "@ember/object/computed"; import Component from "@ember/component"; import { default as computed, @@ -22,7 +23,7 @@ export default Component.extend({ } }, - canEdit: Ember.computed.not("model.automatic"), + canEdit: not("model.automatic"), @computed("basicNameValidation", "uniqueNameValidation") nameValidation(basicNameValidation, uniqueNameValidation) { diff --git a/app/assets/javascripts/discourse/components/input-tip.js.es6 b/app/assets/javascripts/discourse/components/input-tip.js.es6 index 1d775464030..28e73eb0a2b 100644 --- a/app/assets/javascripts/discourse/components/input-tip.js.es6 +++ b/app/assets/javascripts/discourse/components/input-tip.js.es6 @@ -1,3 +1,4 @@ +import { alias, not } from "@ember/object/computed"; import Component from "@ember/component"; import { bufferedRender } from "discourse-common/lib/buffered-render"; import { iconHTML } from "discourse-common/lib/icon-library"; @@ -7,8 +8,8 @@ export default Component.extend( classNameBindings: [":tip", "good", "bad"], rerenderTriggers: ["validation"], - bad: Ember.computed.alias("validation.failed"), - good: Ember.computed.not("bad"), + bad: alias("validation.failed"), + good: not("bad"), buildBuffer(buffer) { const reason = this.get("validation.reason"); diff --git a/app/assets/javascripts/discourse/components/invite-panel.js.es6 b/app/assets/javascripts/discourse/components/invite-panel.js.es6 index c7f09e6bf3e..513b9be3662 100644 --- a/app/assets/javascripts/discourse/components/invite-panel.js.es6 +++ b/app/assets/javascripts/discourse/components/invite-panel.js.es6 @@ -1,3 +1,4 @@ +import { alias, and, equal } from "@ember/object/computed"; import EmberObject from "@ember/object"; import Component from "@ember/component"; import { emailValid } from "discourse/lib/utilities"; @@ -9,8 +10,8 @@ import { i18n } from "discourse/lib/computed"; export default Component.extend({ tagName: null, - inviteModel: Ember.computed.alias("panel.model.inviteModel"), - userInvitedShow: Ember.computed.alias("panel.model.userInvitedShow"), + inviteModel: alias("panel.model.inviteModel"), + userInvitedShow: alias("panel.model.userInvitedShow"), // If this isn't defined, it will proxy to the user topic on the preferences // page which is wrong. @@ -20,7 +21,7 @@ export default Component.extend({ inviteIcon: "envelope", invitingExistingUserToTopic: false, - isAdmin: Ember.computed.alias("currentUser.admin"), + isAdmin: alias("currentUser.admin"), willDestroyElement() { this._super(...arguments); @@ -137,18 +138,18 @@ export default Component.extend({ return canInviteViaEmail && !isPM; }, - topicId: Ember.computed.alias("inviteModel.id"), + topicId: alias("inviteModel.id"), // eg: visible only to specific group members - isPrivateTopic: Ember.computed.and( + isPrivateTopic: and( "invitingToTopic", "inviteModel.category.read_restricted" ), - isPM: Ember.computed.equal("inviteModel.archetype", "private_message"), + isPM: equal("inviteModel.archetype", "private_message"), // scope to allowed usernames - allowExistingMembers: Ember.computed.alias("invitingToTopic"), + allowExistingMembers: alias("invitingToTopic"), @computed("isAdmin", "inviteModel.group_users") isGroupOwnerOrAdmin(isAdmin, groupUsers) { diff --git a/app/assets/javascripts/discourse/components/modal-tab.js.es6 b/app/assets/javascripts/discourse/components/modal-tab.js.es6 index 8508b37a879..94ff00ef9dc 100644 --- a/app/assets/javascripts/discourse/components/modal-tab.js.es6 +++ b/app/assets/javascripts/discourse/components/modal-tab.js.es6 @@ -1,3 +1,4 @@ +import { equal, alias } from "@ember/object/computed"; import Component from "@ember/component"; import { propertyEqual } from "discourse/lib/computed"; @@ -8,8 +9,8 @@ export default Component.extend({ selectedPanel: null, panelsLength: null, classNameBindings: ["isActive", "singleTab", "panel.id"], - singleTab: Ember.computed.equal("panelsLength", 1), - title: Ember.computed.alias("panel.title"), + singleTab: equal("panelsLength", 1), + title: alias("panel.title"), isActive: propertyEqual("panel.id", "selectedPanel.id"), click() { diff --git a/app/assets/javascripts/discourse/components/popup-input-tip.js.es6 b/app/assets/javascripts/discourse/components/popup-input-tip.js.es6 index 38e8fb15036..38930d57e49 100644 --- a/app/assets/javascripts/discourse/components/popup-input-tip.js.es6 +++ b/app/assets/javascripts/discourse/components/popup-input-tip.js.es6 @@ -1,3 +1,4 @@ +import { alias, not } from "@ember/object/computed"; import Component from "@ember/component"; import { iconHTML } from "discourse-common/lib/icon-library"; import { @@ -19,8 +20,8 @@ export default Component.extend( this.set("validation.lastShownAt", null); }, - bad: Ember.computed.alias("validation.failed"), - good: Ember.computed.not("bad"), + bad: alias("validation.failed"), + good: not("bad"), @computed("shownAt", "validation.lastShownAt") lastShownAt(shownAt, lastShownAt) { diff --git a/app/assets/javascripts/discourse/components/reviewable-bundled-action.js.es6 b/app/assets/javascripts/discourse/components/reviewable-bundled-action.js.es6 index 1a119130671..2b3cc0fdf48 100644 --- a/app/assets/javascripts/discourse/components/reviewable-bundled-action.js.es6 +++ b/app/assets/javascripts/discourse/components/reviewable-bundled-action.js.es6 @@ -1,9 +1,10 @@ +import { gt, alias } from "@ember/object/computed"; import Component from "@ember/component"; export default Component.extend({ tagName: "", - multiple: Ember.computed.gt("bundle.actions.length", 1), - first: Ember.computed.alias("bundle.actions.firstObject"), + multiple: gt("bundle.actions.length", 1), + first: alias("bundle.actions.firstObject"), actions: { performById(id) { diff --git a/app/assets/javascripts/discourse/components/reviewable-conversation-post.js.es6 b/app/assets/javascripts/discourse/components/reviewable-conversation-post.js.es6 index 2a6c31051c8..9fc360d10c8 100644 --- a/app/assets/javascripts/discourse/components/reviewable-conversation-post.js.es6 +++ b/app/assets/javascripts/discourse/components/reviewable-conversation-post.js.es6 @@ -1,4 +1,5 @@ +import { gte } from "@ember/object/computed"; import Component from "@ember/component"; export default Component.extend({ - showUsername: Ember.computed.gte("index", 1) + showUsername: gte("index", 1) }); diff --git a/app/assets/javascripts/discourse/components/reviewable-flagged-post.js.es6 b/app/assets/javascripts/discourse/components/reviewable-flagged-post.js.es6 index 607d70dbda2..58c48d1bbf1 100644 --- a/app/assets/javascripts/discourse/components/reviewable-flagged-post.js.es6 +++ b/app/assets/javascripts/discourse/components/reviewable-flagged-post.js.es6 @@ -1,3 +1,4 @@ +import { gt } from "@ember/object/computed"; import Component from "@ember/component"; import computed from "ember-addons/ember-computed-decorators"; 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"; export default Component.extend({ - hasEdits: Ember.computed.gt("reviewable.post_version", 1), + hasEdits: gt("reviewable.post_version", 1), @computed("reviewable.post_updated_at") historyClass(updatedAt) { diff --git a/app/assets/javascripts/discourse/components/reviewable-histories.js.es6 b/app/assets/javascripts/discourse/components/reviewable-histories.js.es6 index 3bcf50b5e14..f52c1c40002 100644 --- a/app/assets/javascripts/discourse/components/reviewable-histories.js.es6 +++ b/app/assets/javascripts/discourse/components/reviewable-histories.js.es6 @@ -1,4 +1,5 @@ +import { filterBy } from "@ember/object/computed"; import Component from "@ember/component"; export default Component.extend({ - filteredHistories: Ember.computed.filterBy("histories", "created", false) + filteredHistories: filterBy("histories", "created", false) }); diff --git a/app/assets/javascripts/discourse/components/share-panel.js.es6 b/app/assets/javascripts/discourse/components/share-panel.js.es6 index 45b9317145d..81408e1efbe 100644 --- a/app/assets/javascripts/discourse/components/share-panel.js.es6 +++ b/app/assets/javascripts/discourse/components/share-panel.js.es6 @@ -1,3 +1,4 @@ +import { alias } from "@ember/object/computed"; import { schedule } from "@ember/runloop"; import Component from "@ember/component"; import { escapeExpression } from "discourse/lib/utilities"; @@ -7,9 +8,9 @@ import Sharing from "discourse/lib/sharing"; export default Component.extend({ 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 sources() { diff --git a/app/assets/javascripts/discourse/components/tag-list.js.es6 b/app/assets/javascripts/discourse/components/tag-list.js.es6 index bc5dbe6531b..551b70c93dd 100644 --- a/app/assets/javascripts/discourse/components/tag-list.js.es6 +++ b/app/assets/javascripts/discourse/components/tag-list.js.es6 @@ -1,3 +1,4 @@ +import { sort } from "@ember/object/computed"; import Component from "@ember/component"; import computed from "ember-addons/ember-computed-decorators"; @@ -5,7 +6,7 @@ export default Component.extend({ classNameBindings: [":tag-list", "categoryClass", "tagGroupNameClass"], isPrivateMessage: false, - sortedTags: Ember.computed.sort("tags", "sortProperties"), + sortedTags: sort("tags", "sortProperties"), @computed("titleKey") title(titleKey) { diff --git a/app/assets/javascripts/discourse/components/time-input.js.es6 b/app/assets/javascripts/discourse/components/time-input.js.es6 index 6ec44fb3067..e636380a770 100644 --- a/app/assets/javascripts/discourse/components/time-input.js.es6 +++ b/app/assets/javascripts/discourse/components/time-input.js.es6 @@ -1,3 +1,4 @@ +import { oneWay, or } from "@ember/object/computed"; import { schedule } from "@ember/runloop"; import Component from "@ember/component"; import { isNumeric } from "discourse/lib/utilities"; @@ -6,11 +7,11 @@ export default Component.extend({ classNames: ["d-time-input"], hours: null, minutes: null, - _hours: Ember.computed.oneWay("hours"), - _minutes: Ember.computed.oneWay("minutes"), - isSafari: Ember.computed.oneWay("capabilities.isSafari"), - isMobile: Ember.computed.oneWay("site.mobileView"), - nativePicker: Ember.computed.or("isSafari", "isMobile"), + _hours: oneWay("hours"), + _minutes: oneWay("minutes"), + isSafari: oneWay("capabilities.isSafari"), + isMobile: oneWay("site.mobileView"), + nativePicker: or("isSafari", "isMobile"), actions: { onInput(options, event) { diff --git a/app/assets/javascripts/discourse/components/topic-footer-buttons.js.es6 b/app/assets/javascripts/discourse/components/topic-footer-buttons.js.es6 index 6845dc6f12d..8a54fff41a4 100644 --- a/app/assets/javascripts/discourse/components/topic-footer-buttons.js.es6 +++ b/app/assets/javascripts/discourse/components/topic-footer-buttons.js.es6 @@ -1,3 +1,4 @@ +import { alias, or, and } from "@ember/object/computed"; import Component from "@ember/component"; import computed from "ember-addons/ember-computed-decorators"; import { getTopicFooterButtons } from "discourse/lib/register-topic-footer-button"; @@ -31,11 +32,11 @@ export default Component.extend({ 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.closed", "topic.deleted" @@ -50,7 +51,7 @@ export default Component.extend({ ); }, - showEditOnFooter: Ember.computed.and( + showEditOnFooter: and( "topic.isPrivateMessage", "site.can_tag_pms" ), diff --git a/app/assets/javascripts/discourse/components/topic-list-item.js.es6 b/app/assets/javascripts/discourse/components/topic-list-item.js.es6 index 771d5dfb35e..6a990165454 100644 --- a/app/assets/javascripts/discourse/components/topic-list-item.js.es6 +++ b/app/assets/javascripts/discourse/components/topic-list-item.js.es6 @@ -1,3 +1,4 @@ +import { alias } from "@ember/object/computed"; import Component from "@ember/component"; import DiscourseURL from "discourse/lib/url"; import computed from "ember-addons/ember-computed-decorators"; @@ -34,7 +35,7 @@ export const ListItemDefaults = { tagName: "tr", classNameBindings: [":topic-list-item", "unboundClassNames", "topic.visited"], attributeBindings: ["data-topic-id"], - "data-topic-id": Ember.computed.alias("topic.id"), + "data-topic-id": alias("topic.id"), didInsertElement() { this._super(...arguments); diff --git a/app/assets/javascripts/discourse/components/topic-list.js.es6 b/app/assets/javascripts/discourse/components/topic-list.js.es6 index 870c68f9c89..6f60a3b4173 100644 --- a/app/assets/javascripts/discourse/components/topic-list.js.es6 +++ b/app/assets/javascripts/discourse/components/topic-list.js.es6 @@ -1,3 +1,4 @@ +import { alias, reads } from "@ember/object/computed"; import { schedule } from "@ember/runloop"; import Component from "@ember/component"; import { @@ -13,7 +14,7 @@ export default Component.extend(LoadMore, { listTitle: "topic.title", // Overwrite this to perform client side filtering of topics, if desired - filteredTopics: Ember.computed.alias("topics"), + filteredTopics: alias("topics"), _init: Ember.on("init", function() { this.addObserver("hideCategory", this.rerender); @@ -32,7 +33,7 @@ export default Component.extend(LoadMore, { return !!this.changeSort; }, - skipHeader: Ember.computed.reads("site.mobileView"), + skipHeader: reads("site.mobileView"), @computed("order") showLikes(order) { diff --git a/app/assets/javascripts/discourse/components/topic-progress.js.es6 b/app/assets/javascripts/discourse/components/topic-progress.js.es6 index 19ec394b035..9d5cb2103f0 100644 --- a/app/assets/javascripts/discourse/components/topic-progress.js.es6 +++ b/app/assets/javascripts/discourse/components/topic-progress.js.es6 @@ -1,3 +1,4 @@ +import { alias } from "@ember/object/computed"; import { scheduleOnce } from "@ember/runloop"; import Component from "@ember/component"; import { @@ -10,7 +11,7 @@ export default Component.extend({ classNameBindings: ["docked"], docked: false, progressPosition: null, - postStream: Ember.computed.alias("topic.postStream"), + postStream: alias("topic.postStream"), _streamPercentage: null, @computed("progressPosition") diff --git a/app/assets/javascripts/discourse/components/user-card-contents.js.es6 b/app/assets/javascripts/discourse/components/user-card-contents.js.es6 index e9ebcde33ac..92fcde3b731 100644 --- a/app/assets/javascripts/discourse/components/user-card-contents.js.es6 +++ b/app/assets/javascripts/discourse/components/user-card-contents.js.es6 @@ -1,3 +1,4 @@ +import { alias, gte, and, gt, not, or } from "@ember/object/computed"; import EmberObject from "@ember/object"; import Component from "@ember/component"; import { @@ -25,28 +26,28 @@ export default Component.extend(CardContentsBase, CanCheckEmails, CleansUp, { allowBackgrounds: setting("allow_profile_backgrounds"), showBadges: setting("enable_badges"), - postStream: Ember.computed.alias("topic.postStream"), - enoughPostsForFiltering: Ember.computed.gte("topicPostCount", 2), - showFilter: Ember.computed.and( + postStream: alias("topic.postStream"), + enoughPostsForFiltering: gte("topicPostCount", 2), + showFilter: and( "viewingTopic", "postStream.hasNoFilters", "enoughPostsForFiltering" ), showName: propertyNotEqual("user.name", "user.username"), - hasUserFilters: Ember.computed.gt("postStream.userFilters.length", 0), - showMoreBadges: Ember.computed.gt("moreBadgesCount", 0), - showDelete: Ember.computed.and( + hasUserFilters: gt("postStream.userFilters.length", 0), + showMoreBadges: gt("moreBadgesCount", 0), + showDelete: and( "viewingAdmin", "showName", "user.canBeDeleted" ), - linkWebsite: Ember.computed.not("user.isBasic"), - hasLocationOrWebsite: Ember.computed.or("user.location", "user.website_name"), - isSuspendedOrHasBio: Ember.computed.or( + linkWebsite: not("user.isBasic"), + hasLocationOrWebsite: or("user.location", "user.website_name"), + isSuspendedOrHasBio: or( "user.suspend_reason", "user.bio_cooked" ), - showCheckEmail: Ember.computed.and("user.staged", "canCheckEmails"), + showCheckEmail: and("user.staged", "canCheckEmails"), user: null, diff --git a/app/assets/javascripts/discourse/components/user-info.js.es6 b/app/assets/javascripts/discourse/components/user-info.js.es6 index 2353dbd5538..5873829a25a 100644 --- a/app/assets/javascripts/discourse/components/user-info.js.es6 +++ b/app/assets/javascripts/discourse/components/user-info.js.es6 @@ -1,3 +1,4 @@ +import { alias } from "@ember/object/computed"; import Component from "@ember/component"; import computed from "ember-addons/ember-computed-decorators"; import { userPath } from "discourse/lib/url"; @@ -16,10 +17,10 @@ export default Component.extend({ return userPath(username); }, - "data-username": Ember.computed.alias("user.username"), + "data-username": alias("user.username"), // TODO: In later ember releases `hasBlock` works without this - hasBlock: Ember.computed.alias("template"), + hasBlock: alias("template"), @computed("user.name", "user.username") name(name, username) { diff --git a/app/assets/javascripts/discourse/components/user-link.js.es6 b/app/assets/javascripts/discourse/components/user-link.js.es6 index cdc7640bb21..6ea395e5f00 100644 --- a/app/assets/javascripts/discourse/components/user-link.js.es6 +++ b/app/assets/javascripts/discourse/components/user-link.js.es6 @@ -1,7 +1,8 @@ +import { alias } from "@ember/object/computed"; import Component from "@ember/component"; export default Component.extend({ tagName: "a", attributeBindings: ["href", "data-user-card"], - href: Ember.computed.alias("user.path"), - "data-user-card": Ember.computed.alias("user.username") + href: alias("user.path"), + "data-user-card": alias("user.username") }); diff --git a/app/assets/javascripts/discourse/components/user-stat.js.es6 b/app/assets/javascripts/discourse/components/user-stat.js.es6 index 90add324689..1f3fe866445 100644 --- a/app/assets/javascripts/discourse/components/user-stat.js.es6 +++ b/app/assets/javascripts/discourse/components/user-stat.js.es6 @@ -1,7 +1,8 @@ +import { equal } from "@ember/object/computed"; import Component from "@ember/component"; export default Component.extend({ classNames: ["user-stat"], type: "number", - isNumber: Ember.computed.equal("type", "number"), - isDuration: Ember.computed.equal("type", "duration") + isNumber: equal("type", "number"), + isDuration: equal("type", "duration") }); diff --git a/app/assets/javascripts/discourse/controllers/about.js.es6 b/app/assets/javascripts/discourse/controllers/about.js.es6 index d238d976efe..85f26757ae8 100644 --- a/app/assets/javascripts/discourse/controllers/about.js.es6 +++ b/app/assets/javascripts/discourse/controllers/about.js.es6 @@ -1,8 +1,9 @@ +import { gt } from "@ember/object/computed"; import Controller from "@ember/controller"; import computed from "ember-addons/ember-computed-decorators"; export default Controller.extend({ - faqOverriden: Ember.computed.gt("siteSettings.faq_url.length", 0), + faqOverriden: gt("siteSettings.faq_url.length", 0), @computed contactInfo() { diff --git a/app/assets/javascripts/discourse/controllers/bulk-notification-level.js.es6 b/app/assets/javascripts/discourse/controllers/bulk-notification-level.js.es6 index e8df3c97726..0d8ac58ca21 100644 --- a/app/assets/javascripts/discourse/controllers/bulk-notification-level.js.es6 +++ b/app/assets/javascripts/discourse/controllers/bulk-notification-level.js.es6 @@ -1,3 +1,4 @@ +import { empty } from "@ember/object/computed"; import { inject } from "@ember/controller"; import Controller from "@ember/controller"; 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: { changeNotificationLevel() { diff --git a/app/assets/javascripts/discourse/controllers/change-owner.js.es6 b/app/assets/javascripts/discourse/controllers/change-owner.js.es6 index 6496ccb0be8..1d16ba3282a 100644 --- a/app/assets/javascripts/discourse/controllers/change-owner.js.es6 +++ b/app/assets/javascripts/discourse/controllers/change-owner.js.es6 @@ -1,3 +1,4 @@ +import { alias } from "@ember/object/computed"; import { next } from "@ember/runloop"; import { inject } from "@ember/controller"; import Controller from "@ember/controller"; @@ -11,10 +12,10 @@ export default Controller.extend(ModalFunctionality, { saving: false, new_user: null, - selectedPostsCount: Ember.computed.alias( + selectedPostsCount: alias( "topicController.selectedPostsCount" ), - selectedPostsUsername: Ember.computed.alias( + selectedPostsUsername: alias( "topicController.selectedPostsUsername" ), diff --git a/app/assets/javascripts/discourse/controllers/composer.js.es6 b/app/assets/javascripts/discourse/controllers/composer.js.es6 index a4ecfb84761..b68fb42a146 100644 --- a/app/assets/javascripts/discourse/controllers/composer.js.es6 +++ b/app/assets/javascripts/discourse/controllers/composer.js.es6 @@ -1,3 +1,4 @@ +import { and, or, alias, reads } from "@ember/object/computed"; import { debounce } from "@ember/runloop"; import { inject as service } from "@ember/service"; import { inject } from "@ember/controller"; @@ -94,9 +95,9 @@ export default Controller.extend({ topic: null, linkLookup: null, showPreview: true, - forcePreview: Ember.computed.and("site.mobileView", "showPreview"), - whisperOrUnlistTopic: Ember.computed.or("isWhispering", "model.unlistTopic"), - categories: Ember.computed.alias("site.categoriesList"), + forcePreview: and("site.mobileView", "showPreview"), + whisperOrUnlistTopic: or("isWhispering", "model.unlistTopic"), + categories: alias("site.categoriesList"), @on("init") _setupPreview() { @@ -178,7 +179,7 @@ export default Controller.extend({ } }), - topicModel: Ember.computed.alias("topicController.model"), + topicModel: alias("topicController.model"), @computed("model.canEditTitle", "model.creatingPrivateMessage") canEditTags(canEditTitle, creatingPrivateMessage) { @@ -200,9 +201,9 @@ export default Controller.extend({ 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") 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") 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) { if (this.disableSubmit) return; diff --git a/app/assets/javascripts/discourse/controllers/create-account.js.es6 b/app/assets/javascripts/discourse/controllers/create-account.js.es6 index b6e6755da7d..7a2e4b1359a 100644 --- a/app/assets/javascripts/discourse/controllers/create-account.js.es6 +++ b/app/assets/javascripts/discourse/controllers/create-account.js.es6 @@ -1,3 +1,4 @@ +import { notEmpty, or, not } from "@ember/object/computed"; import { inject } from "@ember/controller"; import Controller from "@ember/controller"; import { ajax } from "discourse/lib/ajax"; @@ -34,9 +35,9 @@ export default Controller.extend( userFields: null, isDeveloper: false, - hasAuthOptions: Ember.computed.notEmpty("authOptions"), + hasAuthOptions: notEmpty("authOptions"), canCreateLocal: setting("enable_local_logins"), - showCreateForm: Ember.computed.or("hasAuthOptions", "canCreateLocal"), + showCreateForm: or("hasAuthOptions", "canCreateLocal"), resetForm() { // We wrap the fields in a structure so we can assign a value @@ -78,7 +79,7 @@ export default Controller.extend( return false; }, - usernameRequired: Ember.computed.not("authOptions.omit_username"), + usernameRequired: not("authOptions.omit_username"), @computed fullnameRequired() { diff --git a/app/assets/javascripts/discourse/controllers/discovery-sortable.js.es6 b/app/assets/javascripts/discourse/controllers/discovery-sortable.js.es6 index 4b9afc6763b..d286a37dab3 100644 --- a/app/assets/javascripts/discourse/controllers/discovery-sortable.js.es6 +++ b/app/assets/javascripts/discourse/controllers/discovery-sortable.js.es6 @@ -1,3 +1,4 @@ +import { alias } from "@ember/object/computed"; import { inject } from "@ember/controller"; import Controller from "@ember/controller"; import DiscourseNavigation from "discourse/components/d-navigation"; @@ -24,7 +25,7 @@ const controllerOpts = { // Aliases for the values controllerOpts.queryParams.forEach( - p => (controllerOpts[p] = Ember.computed.alias(`discoveryTopics.${p}`)) + p => (controllerOpts[p] = alias(`discoveryTopics.${p}`)) ); const SortableController = Controller.extend(controllerOpts); @@ -32,7 +33,7 @@ const SortableController = Controller.extend(controllerOpts); export const addDiscoveryQueryParam = function(p, opts) { queryParams[p] = opts; const cOpts = {}; - cOpts[p] = Ember.computed.alias(`discoveryTopics.${p}`); + cOpts[p] = alias(`discoveryTopics.${p}`); cOpts["queryParams"] = Object.keys(queryParams); SortableController.reopen(cOpts); diff --git a/app/assets/javascripts/discourse/controllers/discovery.js.es6 b/app/assets/javascripts/discourse/controllers/discovery.js.es6 index 5f23a85b335..6345bb8aa23 100644 --- a/app/assets/javascripts/discourse/controllers/discovery.js.es6 +++ b/app/assets/javascripts/discourse/controllers/discovery.js.es6 @@ -1,3 +1,4 @@ +import { alias, not } from "@ember/object/computed"; import { inject } from "@ember/controller"; import Controller from "@ember/controller"; import DiscourseURL from "discourse/lib/url"; @@ -9,10 +10,10 @@ export default Controller.extend({ loading: false, - category: Ember.computed.alias("navigationCategory.category"), - noSubcategories: Ember.computed.alias("navigationCategory.noSubcategories"), + category: alias("navigationCategory.category"), + noSubcategories: alias("navigationCategory.noSubcategories"), - loadedAllItems: Ember.computed.not("discoveryTopics.model.canLoadMore"), + loadedAllItems: not("discoveryTopics.model.canLoadMore"), _showFooter: function() { this.set("application.showFooter", this.loadedAllItems); diff --git a/app/assets/javascripts/discourse/controllers/discovery/categories.js.es6 b/app/assets/javascripts/discourse/controllers/discovery/categories.js.es6 index f0511bae373..66532a9952b 100644 --- a/app/assets/javascripts/discourse/controllers/discovery/categories.js.es6 +++ b/app/assets/javascripts/discourse/controllers/discovery/categories.js.es6 @@ -1,3 +1,4 @@ +import { reads } from "@ember/object/computed"; import { inject } from "@ember/controller"; import computed from "ember-addons/ember-computed-decorators"; 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 category: null, - canEdit: Ember.computed.reads("currentUser.staff"), + canEdit: reads("currentUser.staff"), @computed("model.categories.[].featuredTopics.length") latestTopicOnly() { diff --git a/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 b/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 index 9dc0c4b98c4..859f621afb2 100644 --- a/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 +++ b/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 @@ -1,3 +1,4 @@ +import { alias, not, gt, empty, notEmpty, equal } from "@ember/object/computed"; import { inject } from "@ember/controller"; import DiscoveryController from "discourse/controllers/discovery"; import { queryParams } from "discourse/controllers/discovery-sortable"; @@ -14,9 +15,9 @@ const controllerOpts = { period: null, - canStar: Ember.computed.alias("currentUser.id"), - showTopicPostBadges: Ember.computed.not("discoveryTopics.new"), - redirectedReason: Ember.computed.alias( + canStar: alias("currentUser.id"), + showTopicPostBadges: not("discoveryTopics.new"), + redirectedReason: alias( "currentUser.redirected_to_top.reason" ), @@ -118,16 +119,16 @@ const controllerOpts = { ); }, - hasTopics: Ember.computed.gt("model.topics.length", 0), - allLoaded: Ember.computed.empty("model.more_topics_url"), + hasTopics: gt("model.topics.length", 0), + allLoaded: empty("model.more_topics_url"), latest: endWith("model.filter", "latest"), new: endWith("model.filter", "new"), - top: Ember.computed.notEmpty("period"), - yearly: Ember.computed.equal("period", "yearly"), - quarterly: Ember.computed.equal("period", "quarterly"), - monthly: Ember.computed.equal("period", "monthly"), - weekly: Ember.computed.equal("period", "weekly"), - daily: Ember.computed.equal("period", "daily"), + top: notEmpty("period"), + yearly: equal("period", "yearly"), + quarterly: equal("period", "quarterly"), + monthly: equal("period", "monthly"), + weekly: equal("period", "weekly"), + daily: equal("period", "daily"), @computed("allLoaded", "model.topics.length") footerMessage(allLoaded, topicsLength) { diff --git a/app/assets/javascripts/discourse/controllers/exception.js.es6 b/app/assets/javascripts/discourse/controllers/exception.js.es6 index 2e3f44ae749..7967f2d24ab 100644 --- a/app/assets/javascripts/discourse/controllers/exception.js.es6 +++ b/app/assets/javascripts/discourse/controllers/exception.js.es6 @@ -1,3 +1,4 @@ +import { equal, gte, none, alias } from "@ember/object/computed"; import { schedule } from "@ember/runloop"; import Controller from "@ember/controller"; import { @@ -43,10 +44,10 @@ export default Controller.extend({ return false; }, - isNotFound: Ember.computed.equal("thrown.status", 404), - isForbidden: Ember.computed.equal("thrown.status", 403), - isServer: Ember.computed.gte("thrown.status", 500), - isUnknown: Ember.computed.none("isNetwork", "isServer"), + isNotFound: equal("thrown.status", 404), + isForbidden: equal("thrown.status", 403), + isServer: gte("thrown.status", 500), + isUnknown: none("isNetwork", "isServer"), // TODO // 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") desc() { diff --git a/app/assets/javascripts/discourse/controllers/flag.js.es6 b/app/assets/javascripts/discourse/controllers/flag.js.es6 index 2b18533279e..8f3c49ebc51 100644 --- a/app/assets/javascripts/discourse/controllers/flag.js.es6 +++ b/app/assets/javascripts/discourse/controllers/flag.js.es6 @@ -1,3 +1,4 @@ +import { not } from "@ember/object/computed"; import EmberObject from "@ember/object"; import Controller from "@ember/controller"; import ModalFunctionality from "discourse/mixins/modal-functionality"; @@ -99,7 +100,7 @@ export default Controller.extend(ModalFunctionality, { return true; }, - submitDisabled: Ember.computed.not("submitEnabled"), + submitDisabled: not("submitEnabled"), // Staff accounts can "take action" @computed("flagTopic", "selected.is_custom_flag") diff --git a/app/assets/javascripts/discourse/controllers/full-page-search.js.es6 b/app/assets/javascripts/discourse/controllers/full-page-search.js.es6 index 7fdd47d57fc..63e8da38fc7 100644 --- a/app/assets/javascripts/discourse/controllers/full-page-search.js.es6 +++ b/app/assets/javascripts/discourse/controllers/full-page-search.js.es6 @@ -1,3 +1,4 @@ +import { or } from "@ember/object/computed"; import { inject } from "@ember/controller"; import Controller from "@ember/controller"; import { ajax } from "discourse/lib/ajax"; @@ -207,7 +208,7 @@ export default Controller.extend({ return page === PAGE_LIMIT; }, - searchButtonDisabled: Ember.computed.or("searching", "loading"), + searchButtonDisabled: or("searching", "loading"), _search() { if (this.searching) { diff --git a/app/assets/javascripts/discourse/controllers/group-index.js.es6 b/app/assets/javascripts/discourse/controllers/group-index.js.es6 index 335a6a3b7d8..2cc94f9f4e2 100644 --- a/app/assets/javascripts/discourse/controllers/group-index.js.es6 +++ b/app/assets/javascripts/discourse/controllers/group-index.js.es6 @@ -1,3 +1,4 @@ +import { alias } from "@ember/object/computed"; import { inject } from "@ember/controller"; import Controller from "@ember/controller"; import { popupAjaxError } from "discourse/lib/ajax-error"; @@ -15,7 +16,7 @@ export default Controller.extend({ loading: false, limit: null, offset: null, - isOwner: Ember.computed.alias("model.is_group_owner"), + isOwner: alias("model.is_group_owner"), showActions: false, filter: null, filterInput: null, diff --git a/app/assets/javascripts/discourse/controllers/history.js.es6 b/app/assets/javascripts/discourse/controllers/history.js.es6 index 8b139e19b73..b261277a786 100644 --- a/app/assets/javascripts/discourse/controllers/history.js.es6 +++ b/app/assets/javascripts/discourse/controllers/history.js.es6 @@ -1,3 +1,4 @@ +import { alias, gt, not, or, equal } from "@ember/object/computed"; import Controller from "@ember/controller"; import ModalFunctionality from "discourse/mixins/modal-functionality"; import { categoryBadgeHTML } from "discourse/helpers/category-link"; @@ -32,10 +33,10 @@ export default Controller.extend(ModalFunctionality, { } }, - previousFeaturedLink: Ember.computed.alias( + previousFeaturedLink: alias( "model.featured_link_changes.previous" ), - currentFeaturedLink: Ember.computed.alias( + currentFeaturedLink: alias( "model.featured_link_changes.current" ), @@ -119,7 +120,7 @@ export default Controller.extend(ModalFunctionality, { return prev && current > prev; }, - displayRevisions: Ember.computed.gt("model.version_count", 2), + displayRevisions: gt("model.version_count", 2), displayGoToFirst: propertyGreaterThan( "model.current_revision", "model.first_revision" @@ -133,15 +134,15 @@ export default Controller.extend(ModalFunctionality, { "model.next_revision" ), - hideGoToFirst: Ember.computed.not("displayGoToFirst"), - hideGoToPrevious: Ember.computed.not("displayGoToPrevious"), - hideGoToNext: Ember.computed.not("displayGoToNext"), - hideGoToLast: Ember.computed.not("displayGoToLast"), + hideGoToFirst: not("displayGoToFirst"), + hideGoToPrevious: not("displayGoToPrevious"), + hideGoToNext: not("displayGoToNext"), + hideGoToLast: not("displayGoToLast"), - loadFirstDisabled: Ember.computed.or("loading", "hideGoToFirst"), - loadPreviousDisabled: Ember.computed.or("loading", "hideGoToPrevious"), - loadNextDisabled: Ember.computed.or("loading", "hideGoToNext"), - loadLastDisabled: Ember.computed.or("loading", "hideGoToLast"), + loadFirstDisabled: or("loading", "hideGoToFirst"), + loadPreviousDisabled: or("loading", "hideGoToPrevious"), + loadNextDisabled: or("loading", "hideGoToNext"), + loadLastDisabled: or("loading", "hideGoToLast"), @computed("model.previous_hidden") displayShow(prevHidden) { @@ -173,7 +174,7 @@ export default Controller.extend(ModalFunctionality, { return this.currentUser && this.currentUser.get("staff"); }, - isEitherRevisionHidden: Ember.computed.or( + isEitherRevisionHidden: or( "model.previous_hidden", "model.current_hidden" ), @@ -194,9 +195,9 @@ export default Controller.extend(ModalFunctionality, { } }, - displayingInline: Ember.computed.equal("viewMode", "inline"), - displayingSideBySide: Ember.computed.equal("viewMode", "side_by_side"), - displayingSideBySideMarkdown: Ember.computed.equal( + displayingInline: equal("viewMode", "inline"), + displayingSideBySide: equal("viewMode", "side_by_side"), + displayingSideBySideMarkdown: equal( "viewMode", "side_by_side_markdown" ), diff --git a/app/assets/javascripts/discourse/controllers/invites-show.js.es6 b/app/assets/javascripts/discourse/controllers/invites-show.js.es6 index 98d5fd5496f..a1291651415 100644 --- a/app/assets/javascripts/discourse/controllers/invites-show.js.es6 +++ b/app/assets/javascripts/discourse/controllers/invites-show.js.es6 @@ -1,3 +1,4 @@ +import { alias, notEmpty } from "@ember/object/computed"; import Controller from "@ember/controller"; import { default as computed } from "ember-addons/ember-computed-decorators"; import getUrl from "discourse-common/lib/get-url"; @@ -15,10 +16,10 @@ export default Controller.extend( NameValidation, UserFieldsValidation, { - invitedBy: Ember.computed.alias("model.invited_by"), - email: Ember.computed.alias("model.email"), - accountUsername: Ember.computed.alias("model.username"), - passwordRequired: Ember.computed.notEmpty("accountPassword"), + invitedBy: alias("model.invited_by"), + email: alias("model.email"), + accountUsername: alias("model.username"), + passwordRequired: notEmpty("accountPassword"), successMessage: null, errorMessage: null, userFields: null, diff --git a/app/assets/javascripts/discourse/controllers/jump-to-post.js.es6 b/app/assets/javascripts/discourse/controllers/jump-to-post.js.es6 index a0d4bd59503..363fffea88f 100644 --- a/app/assets/javascripts/discourse/controllers/jump-to-post.js.es6 +++ b/app/assets/javascripts/discourse/controllers/jump-to-post.js.es6 @@ -1,3 +1,4 @@ +import { alias } from "@ember/object/computed"; import { next } from "@ember/runloop"; import Controller from "@ember/controller"; import ModalFunctionality from "discourse/mixins/modal-functionality"; @@ -6,7 +7,7 @@ export default Controller.extend(ModalFunctionality, { model: null, postNumber: null, postDate: null, - filteredPostsCount: Ember.computed.alias( + filteredPostsCount: alias( "topic.postStream.filteredPostsCount" ), diff --git a/app/assets/javascripts/discourse/controllers/login.js.es6 b/app/assets/javascripts/discourse/controllers/login.js.es6 index 25011468057..177700eb72b 100644 --- a/app/assets/javascripts/discourse/controllers/login.js.es6 +++ b/app/assets/javascripts/discourse/controllers/login.js.es6 @@ -1,3 +1,4 @@ +import { alias, or, readOnly } from "@ember/object/computed"; import EmberObject from "@ember/object"; import { next } from "@ember/runloop"; import { scheduleOnce } from "@ember/runloop"; @@ -38,7 +39,7 @@ export default Controller.extend(ModalFunctionality, { canLoginLocal: setting("enable_local_logins"), canLoginLocalWithEmail: setting("enable_local_logins_via_email"), - loginRequired: Ember.computed.alias("application.loginRequired"), + loginRequired: alias("application.loginRequired"), secondFactorMethod: SECOND_FACTOR_METHODS.TOTP, resetForm() { @@ -86,14 +87,14 @@ export default Controller.extend(ModalFunctionality, { return loggingIn ? "login.logging_in" : "login.title"; }, - loginDisabled: Ember.computed.or("loggingIn", "loggedIn"), + loginDisabled: or("loggingIn", "loggedIn"), @computed("loggingIn", "application.canSignUp") showSignupLink(loggingIn, canSignUp) { return canSignUp && !loggingIn; }, - showSpinner: Ember.computed.readOnly("loggingIn"), + showSpinner: readOnly("loggingIn"), @computed("canLoginLocalWithEmail", "processingEmailLink") showLoginWithEmailLink(canLoginLocalWithEmail, processingEmailLink) { diff --git a/app/assets/javascripts/discourse/controllers/move-to-topic.js.es6 b/app/assets/javascripts/discourse/controllers/move-to-topic.js.es6 index 7c8c84648c0..3b1572c2f4b 100644 --- a/app/assets/javascripts/discourse/controllers/move-to-topic.js.es6 +++ b/app/assets/javascripts/discourse/controllers/move-to-topic.js.es6 @@ -1,3 +1,4 @@ +import { alias, equal } from "@ember/object/computed"; import { next } from "@ember/runloop"; import { inject } from "@ember/controller"; import Controller from "@ember/controller"; @@ -12,13 +13,13 @@ export default Controller.extend(ModalFunctionality, { saving: false, categoryId: null, tags: null, - canAddTags: Ember.computed.alias("site.can_create_tag"), - canTagMessages: Ember.computed.alias("site.can_tag_pms"), + canAddTags: alias("site.can_create_tag"), + canTagMessages: alias("site.can_tag_pms"), selectedTopicId: null, - newTopic: Ember.computed.equal("selection", "new_topic"), - existingTopic: Ember.computed.equal("selection", "existing_topic"), - newMessage: Ember.computed.equal("selection", "new_message"), - existingMessage: Ember.computed.equal("selection", "existing_message"), + newTopic: equal("selection", "new_topic"), + existingTopic: equal("selection", "existing_topic"), + newMessage: equal("selection", "new_message"), + existingMessage: equal("selection", "existing_message"), participants: null, init() { @@ -40,11 +41,11 @@ export default Controller.extend(ModalFunctionality, { }, topicController: inject("topic"), - selectedPostsCount: Ember.computed.alias( + selectedPostsCount: alias( "topicController.selectedPostsCount" ), - selectedAllPosts: Ember.computed.alias("topicController.selectedAllPosts"), - selectedPosts: Ember.computed.alias("topicController.selectedPosts"), + selectedAllPosts: alias("topicController.selectedAllPosts"), + selectedPosts: alias("topicController.selectedPosts"), @computed("saving", "selectedTopicId", "topicName") buttonDisabled(saving, selectedTopicId, topicName) { diff --git a/app/assets/javascripts/discourse/controllers/navigation/category.js.es6 b/app/assets/javascripts/discourse/controllers/navigation/category.js.es6 index a54af35e2ac..1b132655769 100644 --- a/app/assets/javascripts/discourse/controllers/navigation/category.js.es6 +++ b/app/assets/javascripts/discourse/controllers/navigation/category.js.es6 @@ -1,8 +1,9 @@ +import { none, and } from "@ember/object/computed"; import NavigationDefaultController from "discourse/controllers/navigation/default"; export default NavigationDefaultController.extend({ - showingParentCategory: Ember.computed.none("category.parentCategory"), - showingSubcategoryList: Ember.computed.and( + showingParentCategory: none("category.parentCategory"), + showingSubcategoryList: and( "category.show_subcategory_list", "showingParentCategory" ) diff --git a/app/assets/javascripts/discourse/controllers/password-reset.js.es6 b/app/assets/javascripts/discourse/controllers/password-reset.js.es6 index 618e7a3c43c..b7a4545aed2 100644 --- a/app/assets/javascripts/discourse/controllers/password-reset.js.es6 +++ b/app/assets/javascripts/discourse/controllers/password-reset.js.es6 @@ -1,3 +1,4 @@ +import { alias, or } from "@ember/object/computed"; import Controller from "@ember/controller"; import { default as computed } from "ember-addons/ember-computed-decorators"; import DiscourseURL from "discourse/lib/url"; @@ -8,12 +9,12 @@ import { SECOND_FACTOR_METHODS } from "discourse/models/user"; import { getWebauthnCredential } from "discourse/lib/webauthn"; export default Controller.extend(PasswordValidation, { - isDeveloper: Ember.computed.alias("model.is_developer"), - admin: Ember.computed.alias("model.admin"), - secondFactorRequired: Ember.computed.alias("model.second_factor_required"), - securityKeyRequired: Ember.computed.alias("model.security_key_required"), - backupEnabled: Ember.computed.alias("model.backup_enabled"), - securityKeyOrSecondFactorRequired: Ember.computed.or( + isDeveloper: alias("model.is_developer"), + admin: alias("model.admin"), + secondFactorRequired: alias("model.second_factor_required"), + securityKeyRequired: alias("model.security_key_required"), + backupEnabled: alias("model.backup_enabled"), + securityKeyOrSecondFactorRequired: or( "model.second_factor_required", "model.security_key_required" ), diff --git a/app/assets/javascripts/discourse/controllers/preferences/account.js.es6 b/app/assets/javascripts/discourse/controllers/preferences/account.js.es6 index 732c51ea736..27f4888b6d5 100644 --- a/app/assets/javascripts/discourse/controllers/preferences/account.js.es6 +++ b/app/assets/javascripts/discourse/controllers/preferences/account.js.es6 @@ -1,3 +1,4 @@ +import { not, or, gt } from "@ember/object/computed"; import Controller from "@ember/controller"; import { iconHTML } from "discourse-common/lib/icon-library"; import CanCheckEmails from "discourse/mixins/can-check-emails"; @@ -34,8 +35,8 @@ export default Controller.extend(CanCheckEmails, PreferencesTabController, { revoking: null, - cannotDeleteAccount: Ember.computed.not("currentUser.can_delete_account"), - deleteDisabled: Ember.computed.or( + cannotDeleteAccount: not("currentUser.can_delete_account"), + deleteDisabled: or( "model.isSaving", "deleting", "cannotDeleteAccount" @@ -54,7 +55,7 @@ export default Controller.extend(CanCheckEmails, PreferencesTabController, { ); }, - canSelectTitle: Ember.computed.gt("model.availableTitles.length", 0), + canSelectTitle: gt("model.availableTitles.length", 0), @computed("model.filteredGroups") canSelectPrimaryGroup(primaryGroupOptions) { @@ -129,7 +130,7 @@ export default Controller.extend(CanCheckEmails, PreferencesTabController, { : tokens.slice(0, DEFAULT_AUTH_TOKENS_COUNT); }, - canShowAllAuthTokens: Ember.computed.gt( + canShowAllAuthTokens: gt( "model.user_auth_tokens.length", DEFAULT_AUTH_TOKENS_COUNT ), diff --git a/app/assets/javascripts/discourse/controllers/preferences/categories.js.es6 b/app/assets/javascripts/discourse/controllers/preferences/categories.js.es6 index b0ec789200c..8f86974e386 100644 --- a/app/assets/javascripts/discourse/controllers/preferences/categories.js.es6 +++ b/app/assets/javascripts/discourse/controllers/preferences/categories.js.es6 @@ -1,3 +1,4 @@ +import { or } from "@ember/object/computed"; import Controller from "@ember/controller"; import PreferencesTabController from "discourse/mixins/preferences-tab-controller"; import { popupAjaxError } from "discourse/lib/ajax-error"; @@ -35,7 +36,7 @@ export default Controller.extend(PreferencesTabController, { return this.siteSettings.remove_muted_tags_from_latest !== "never"; }, - canSave: Ember.computed.or("canSee", "currentUser.admin"), + canSave: or("canSee", "currentUser.admin"), actions: { save() { diff --git a/app/assets/javascripts/discourse/controllers/preferences/email.js.es6 b/app/assets/javascripts/discourse/controllers/preferences/email.js.es6 index 9f59a93e4b6..c25db36a437 100644 --- a/app/assets/javascripts/discourse/controllers/preferences/email.js.es6 +++ b/app/assets/javascripts/discourse/controllers/preferences/email.js.es6 @@ -1,3 +1,4 @@ +import { empty, or } from "@ember/object/computed"; import Controller from "@ember/controller"; import { propertyEqual } from "discourse/lib/computed"; import InputValidation from "discourse/models/input-validation"; @@ -11,9 +12,9 @@ export default Controller.extend({ success: false, newEmail: null, - newEmailEmpty: Ember.computed.empty("newEmail"), + newEmailEmpty: empty("newEmail"), - saveDisabled: Ember.computed.or( + saveDisabled: or( "saving", "newEmailEmpty", "taken", diff --git a/app/assets/javascripts/discourse/controllers/preferences/emails.js.es6 b/app/assets/javascripts/discourse/controllers/preferences/emails.js.es6 index cc8d8aab4ed..a2001457e52 100644 --- a/app/assets/javascripts/discourse/controllers/preferences/emails.js.es6 +++ b/app/assets/javascripts/discourse/controllers/preferences/emails.js.es6 @@ -1,3 +1,4 @@ +import { equal } from "@ember/object/computed"; import Controller from "@ember/controller"; import PreferencesTabController from "discourse/mixins/preferences-tab-controller"; import { default as computed } from "ember-addons/ember-computed-decorators"; @@ -10,11 +11,11 @@ const EMAIL_LEVELS = { }; export default Controller.extend(PreferencesTabController, { - emailMessagesLevelAway: Ember.computed.equal( + emailMessagesLevelAway: equal( "model.user_option.email_messages_level", EMAIL_LEVELS.ONLY_WHEN_AWAY ), - emailLevelAway: Ember.computed.equal( + emailLevelAway: equal( "model.user_option.email_level", EMAIL_LEVELS.ONLY_WHEN_AWAY ), diff --git a/app/assets/javascripts/discourse/controllers/preferences/second-factor.js.es6 b/app/assets/javascripts/discourse/controllers/preferences/second-factor.js.es6 index 04ad204320f..233ed03390d 100644 --- a/app/assets/javascripts/discourse/controllers/preferences/second-factor.js.es6 +++ b/app/assets/javascripts/discourse/controllers/preferences/second-factor.js.es6 @@ -1,3 +1,4 @@ +import { alias, and } from "@ember/object/computed"; import Controller from "@ember/controller"; import { default as computed } from "ember-addons/ember-computed-decorators"; import CanCheckEmails from "discourse/mixins/can-check-emails"; @@ -15,11 +16,11 @@ export default Controller.extend(CanCheckEmails, { password: null, errorMessage: null, newUsername: null, - backupEnabled: Ember.computed.alias("model.second_factor_backup_enabled"), + backupEnabled: alias("model.second_factor_backup_enabled"), secondFactorMethod: SECOND_FACTOR_METHODS.TOTP, totps: null, - loaded: Ember.computed.and("secondFactorImage", "secondFactorKey"), + loaded: and("secondFactorImage", "secondFactorKey"), init() { this._super(...arguments); diff --git a/app/assets/javascripts/discourse/controllers/preferences/username.js.es6 b/app/assets/javascripts/discourse/controllers/preferences/username.js.es6 index 28d683a9716..aab336e2b08 100644 --- a/app/assets/javascripts/discourse/controllers/preferences/username.js.es6 +++ b/app/assets/javascripts/discourse/controllers/preferences/username.js.es6 @@ -1,3 +1,4 @@ +import { empty, or } from "@ember/object/computed"; import Controller from "@ember/controller"; import { default as computed, @@ -16,8 +17,8 @@ export default Controller.extend({ maxLength: setting("max_username_length"), minLength: setting("min_username_length"), - newUsernameEmpty: Ember.computed.empty("newUsername"), - saveDisabled: Ember.computed.or( + newUsernameEmpty: empty("newUsername"), + saveDisabled: or( "saving", "newUsernameEmpty", "taken", diff --git a/app/assets/javascripts/discourse/controllers/preferences/users.js.es6 b/app/assets/javascripts/discourse/controllers/preferences/users.js.es6 index aca7b02fda0..fc675cf052d 100644 --- a/app/assets/javascripts/discourse/controllers/preferences/users.js.es6 +++ b/app/assets/javascripts/discourse/controllers/preferences/users.js.es6 @@ -1,11 +1,12 @@ +import { alias, gte, or } from "@ember/object/computed"; import Controller from "@ember/controller"; import PreferencesTabController from "discourse/mixins/preferences-tab-controller"; import { popupAjaxError } from "discourse/lib/ajax-error"; export default Controller.extend(PreferencesTabController, { - ignoredUsernames: Ember.computed.alias("model.ignored_usernames"), - userIsMemberOrAbove: Ember.computed.gte("model.trust_level", 2), - ignoredEnabled: Ember.computed.or("userIsMemberOrAbove", "model.staff"), + ignoredUsernames: alias("model.ignored_usernames"), + userIsMemberOrAbove: gte("model.trust_level", 2), + ignoredEnabled: or("userIsMemberOrAbove", "model.staff"), init() { this._super(...arguments); diff --git a/app/assets/javascripts/discourse/controllers/raw-email.js.es6 b/app/assets/javascripts/discourse/controllers/raw-email.js.es6 index 07a58388a24..fbdeb103a56 100644 --- a/app/assets/javascripts/discourse/controllers/raw-email.js.es6 +++ b/app/assets/javascripts/discourse/controllers/raw-email.js.es6 @@ -1,3 +1,4 @@ +import { equal } from "@ember/object/computed"; import Controller from "@ember/controller"; import ModalFunctionality from "discourse/mixins/modal-functionality"; import Post from "discourse/models/post"; @@ -11,9 +12,9 @@ export default Controller.extend(ModalFunctionality, { tab: "raw", - showRawEmail: Ember.computed.equal("tab", "raw"), - showTextPart: Ember.computed.equal("tab", "text_part"), - showHtmlPart: Ember.computed.equal("tab", "html_part"), + showRawEmail: equal("tab", "raw"), + showTextPart: equal("tab", "text_part"), + showHtmlPart: equal("tab", "html_part"), onShow() { this.send("displayRaw"); diff --git a/app/assets/javascripts/discourse/controllers/reorder-categories.js.es6 b/app/assets/javascripts/discourse/controllers/reorder-categories.js.es6 index c7dda8c792a..93ebfd4165b 100644 --- a/app/assets/javascripts/discourse/controllers/reorder-categories.js.es6 +++ b/app/assets/javascripts/discourse/controllers/reorder-categories.js.es6 @@ -1,3 +1,4 @@ +import { sort } from "@ember/object/computed"; import EmberObjectProxy from "@ember/object/proxy"; import Controller from "@ember/controller"; import { ajax } from "discourse/lib/ajax"; @@ -28,7 +29,7 @@ export default Controller.extend(ModalFunctionality, Ember.Evented, { return categories.map(c => bufProxy.create({ content: c })); }, - categoriesOrdered: Ember.computed.sort( + categoriesOrdered: sort( "categoriesBuffered", "categoriesSorting" ), diff --git a/app/assets/javascripts/discourse/controllers/request-group-membership-form.js.es6 b/app/assets/javascripts/discourse/controllers/request-group-membership-form.js.es6 index 0bab180cb90..80a3b13edc5 100644 --- a/app/assets/javascripts/discourse/controllers/request-group-membership-form.js.es6 +++ b/app/assets/javascripts/discourse/controllers/request-group-membership-form.js.es6 @@ -1,3 +1,4 @@ +import { alias } from "@ember/object/computed"; import Controller from "@ember/controller"; import computed from "ember-addons/ember-computed-decorators"; import { popupAjaxError } from "discourse/lib/ajax-error"; @@ -6,7 +7,7 @@ import ModalFunctionality from "discourse/mixins/modal-functionality"; export default Controller.extend(ModalFunctionality, { loading: false, - reason: Ember.computed.alias("model.membership_request_template"), + reason: alias("model.membership_request_template"), @computed("model.name") title(groupName) { diff --git a/app/assets/javascripts/discourse/controllers/second-factor-backup-edit.js.es6 b/app/assets/javascripts/discourse/controllers/second-factor-backup-edit.js.es6 index 6554a77cd1f..68c6c832115 100644 --- a/app/assets/javascripts/discourse/controllers/second-factor-backup-edit.js.es6 +++ b/app/assets/javascripts/discourse/controllers/second-factor-backup-edit.js.es6 @@ -1,3 +1,4 @@ +import { alias } from "@ember/object/computed"; import { later } from "@ember/runloop"; import Controller from "@ember/controller"; import { default as computed } from "ember-addons/ember-computed-decorators"; @@ -8,8 +9,8 @@ export default Controller.extend(ModalFunctionality, { loading: false, errorMessage: null, successMessage: null, - backupEnabled: Ember.computed.alias("model.second_factor_backup_enabled"), - remainingCodes: Ember.computed.alias( + backupEnabled: alias("model.second_factor_backup_enabled"), + remainingCodes: alias( "model.second_factor_remaining_backup_codes" ), backupCodes: null, diff --git a/app/assets/javascripts/discourse/controllers/static.js.es6 b/app/assets/javascripts/discourse/controllers/static.js.es6 index 632fe18c92b..587e14da81b 100644 --- a/app/assets/javascripts/discourse/controllers/static.js.es6 +++ b/app/assets/javascripts/discourse/controllers/static.js.es6 @@ -1,3 +1,4 @@ +import { equal } from "@ember/object/computed"; import { inject } from "@ember/controller"; import Controller from "@ember/controller"; import { ajax } from "discourse/lib/ajax"; @@ -7,7 +8,7 @@ import { userPath } from "discourse/lib/url"; export default Controller.extend({ application: inject(), - showLoginButton: Ember.computed.equal("model.path", "login"), + showLoginButton: equal("model.path", "login"), @computed("model.path") bodyClass: path => `static-${path}`, diff --git a/app/assets/javascripts/discourse/controllers/tags-index.js.es6 b/app/assets/javascripts/discourse/controllers/tags-index.js.es6 index 81457b585c7..c2ec12fda61 100644 --- a/app/assets/javascripts/discourse/controllers/tags-index.js.es6 +++ b/app/assets/javascripts/discourse/controllers/tags-index.js.es6 @@ -1,3 +1,4 @@ +import { alias, notEmpty } from "@ember/object/computed"; import Controller from "@ember/controller"; import computed from "ember-addons/ember-computed-decorators"; import showModal from "discourse/lib/show-modal"; @@ -8,9 +9,9 @@ export default Controller.extend({ sortedByCount: true, sortedByName: false, - canAdminTags: Ember.computed.alias("currentUser.staff"), - groupedByCategory: Ember.computed.notEmpty("model.extras.categories"), - groupedByTagGroup: Ember.computed.notEmpty("model.extras.tag_groups"), + canAdminTags: alias("currentUser.staff"), + groupedByCategory: notEmpty("model.extras.categories"), + groupedByTagGroup: notEmpty("model.extras.tag_groups"), init() { this._super(...arguments); diff --git a/app/assets/javascripts/discourse/controllers/tags-show.js.es6 b/app/assets/javascripts/discourse/controllers/tags-show.js.es6 index 3cccb318f30..9d787fe8a4d 100644 --- a/app/assets/javascripts/discourse/controllers/tags-show.js.es6 +++ b/app/assets/javascripts/discourse/controllers/tags-show.js.es6 @@ -1,3 +1,4 @@ +import { alias } from "@ember/object/computed"; import { inject } from "@ember/controller"; import Controller from "@ember/controller"; import { @@ -56,7 +57,7 @@ export default Controller.extend(BulkTopicSelection, { tag: null, additionalTags: null, list: null, - canAdminTag: Ember.computed.alias("currentUser.staff"), + canAdminTag: alias("currentUser.staff"), filterMode: null, navMode: "latest", loading: false, @@ -69,7 +70,7 @@ export default Controller.extend(BulkTopicSelection, { max_posts: null, q: null, - categories: Ember.computed.alias("site.categoriesList"), + categories: alias("site.categoriesList"), @computed("list", "list.draft") createTopicLabel(list, listDraft) { diff --git a/app/assets/javascripts/discourse/controllers/topic-bulk-actions.js.es6 b/app/assets/javascripts/discourse/controllers/topic-bulk-actions.js.es6 index 6df0ba9ac8e..d2a809fc6ed 100644 --- a/app/assets/javascripts/discourse/controllers/topic-bulk-actions.js.es6 +++ b/app/assets/javascripts/discourse/controllers/topic-bulk-actions.js.es6 @@ -1,3 +1,4 @@ +import { empty, alias } from "@ember/object/computed"; import Controller from "@ember/controller"; import ModalFunctionality from "discourse/mixins/modal-functionality"; @@ -71,8 +72,8 @@ addBulkButton("deleteTopics", "delete", { export default Controller.extend(ModalFunctionality, { tags: null, - emptyTags: Ember.computed.empty("tags"), - categoryId: Ember.computed.alias("model.category.id"), + emptyTags: empty("tags"), + categoryId: alias("model.category.id"), onShow() { const topics = this.get("model.topics"); diff --git a/app/assets/javascripts/discourse/controllers/topic.js.es6 b/app/assets/javascripts/discourse/controllers/topic.js.es6 index 06ac89f3ad2..0f236ba80fb 100644 --- a/app/assets/javascripts/discourse/controllers/topic.js.es6 +++ b/app/assets/javascripts/discourse/controllers/topic.js.es6 @@ -1,3 +1,4 @@ +import { or, and, not, alias } from "@ember/object/computed"; import EmberObject from "@ember/object"; import { next } from "@ember/runloop"; import { scheduleOnce } from "@ember/runloop"; @@ -45,7 +46,7 @@ export default Controller.extend(bufferedProperty("model"), { selectedPostIds: null, editingTopic: false, queryParams: ["filter", "username_filters"], - loadedAllPosts: Ember.computed.or( + loadedAllPosts: or( "model.postStream.loadedAllPosts", "model.postStream.loadingLastPost" ), @@ -59,7 +60,7 @@ export default Controller.extend(bufferedProperty("model"), { filter: null, quoteState: null, - canRemoveTopicFeaturedLink: Ember.computed.and( + canRemoveTopicFeaturedLink: and( "canEditTopicFeaturedLink", "buffered.featured_link" ), @@ -140,7 +141,7 @@ export default Controller.extend(bufferedProperty("model"), { }); }, - showCategoryChooser: Ember.computed.not("model.isPrivateMessage"), + showCategoryChooser: not("model.isPrivateMessage"), gotoInbox(name) { let url = userPath(this.get("currentUser.username_lower") + "/messages"); @@ -1147,12 +1148,12 @@ export default Controller.extend(bufferedProperty("model"), { } }, - hasError: Ember.computed.or("model.errorHtml", "model.errorMessage"), - noErrorYet: Ember.computed.not("hasError"), + hasError: or("model.errorHtml", "model.errorMessage"), + noErrorYet: not("hasError"), - categories: Ember.computed.alias("site.categoriesList"), + categories: alias("site.categoriesList"), - selectedPostsCount: Ember.computed.alias("selectedPostIds.length"), + selectedPostsCount: alias("selectedPostIds.length"), @computed( "selectedPostIds", @@ -1201,7 +1202,7 @@ export default Controller.extend(bufferedProperty("model"), { return isMegaTopic ? false : !selectedAllPosts; }, - canDeselectAll: Ember.computed.alias("selectedAllPosts"), + canDeselectAll: alias("selectedAllPosts"), @computed( "currentUser.staff", diff --git a/app/assets/javascripts/discourse/controllers/upload-selector.js.es6 b/app/assets/javascripts/discourse/controllers/upload-selector.js.es6 index cfb051c1f29..87c73494a0d 100644 --- a/app/assets/javascripts/discourse/controllers/upload-selector.js.es6 +++ b/app/assets/javascripts/discourse/controllers/upload-selector.js.es6 @@ -1,3 +1,4 @@ +import { equal } from "@ember/object/computed"; import Controller from "@ember/controller"; import ModalFunctionality from "discourse/mixins/modal-functionality"; import { @@ -22,8 +23,8 @@ export default Controller.extend(ModalFunctionality, { showMore: false, imageUrl: null, imageLink: null, - local: Ember.computed.equal("selection", "local"), - remote: Ember.computed.equal("selection", "remote"), + local: equal("selection", "local"), + remote: equal("selection", "remote"), selection: "local", @computed() diff --git a/app/assets/javascripts/discourse/controllers/user-activity.js.es6 b/app/assets/javascripts/discourse/controllers/user-activity.js.es6 index 237b06cb1d7..596125d221e 100644 --- a/app/assets/javascripts/discourse/controllers/user-activity.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user-activity.js.es6 @@ -1,3 +1,4 @@ +import { alias } from "@ember/object/computed"; import { inject as service } from "@ember/service"; import { inject } from "@ember/controller"; import Controller from "@ember/controller"; @@ -9,7 +10,7 @@ export default Controller.extend({ user: inject(), userActionType: null, - canDownloadPosts: Ember.computed.alias("user.viewingSelf"), + canDownloadPosts: alias("user.viewingSelf"), _showFooter: function() { var showFooter; diff --git a/app/assets/javascripts/discourse/controllers/user-badges.js.es6 b/app/assets/javascripts/discourse/controllers/user-badges.js.es6 index a19984feb07..01df9566afe 100644 --- a/app/assets/javascripts/discourse/controllers/user-badges.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user-badges.js.es6 @@ -1,9 +1,10 @@ +import { alias, sort } from "@ember/object/computed"; import { inject } from "@ember/controller"; import Controller from "@ember/controller"; export default Controller.extend({ user: inject(), - username: Ember.computed.alias("user.model.username_lower"), - sortedBadges: Ember.computed.sort("model", "badgeSortOrder"), + username: alias("user.model.username_lower"), + sortedBadges: sort("model", "badgeSortOrder"), init() { this._super(...arguments); diff --git a/app/assets/javascripts/discourse/controllers/user-invited-show.js.es6 b/app/assets/javascripts/discourse/controllers/user-invited-show.js.es6 index 7f2ef2ee873..8a8c102b0e2 100644 --- a/app/assets/javascripts/discourse/controllers/user-invited-show.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user-invited-show.js.es6 @@ -1,3 +1,4 @@ +import { equal, reads, gte } from "@ember/object/computed"; import Controller from "@ember/controller"; import Invite from "discourse/models/invite"; import debounce from "discourse/lib/debounce"; @@ -32,7 +33,7 @@ export default Controller.extend({ ); }, 250), - inviteRedeemed: Ember.computed.equal("filter", "redeemed"), + inviteRedeemed: equal("filter", "redeemed"), @computed("filter") showBulkActionButtons(filter) { @@ -43,11 +44,11 @@ export default Controller.extend({ ); }, - canInviteToForum: Ember.computed.reads("currentUser.can_invite_to_forum"), + canInviteToForum: reads("currentUser.can_invite_to_forum"), - canBulkInvite: Ember.computed.reads("currentUser.admin"), + canBulkInvite: reads("currentUser.admin"), - showSearch: Ember.computed.gte("totalInvites", 10), + showSearch: gte("totalInvites", 10), @computed("invitesCount.total", "invitesCount.pending") pendingLabel(invitesCountTotal, invitesCountPending) { diff --git a/app/assets/javascripts/discourse/controllers/user-private-messages.js.es6 b/app/assets/javascripts/discourse/controllers/user-private-messages.js.es6 index d7321e37cc5..1d69acfee7c 100644 --- a/app/assets/javascripts/discourse/controllers/user-private-messages.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user-private-messages.js.es6 @@ -1,3 +1,4 @@ +import { alias, equal, and } from "@ember/object/computed"; import { inject as service } from "@ember/service"; import { inject } from "@ember/controller"; import Controller from "@ember/controller"; @@ -10,16 +11,16 @@ export default Controller.extend({ user: inject(), pmView: false, - viewingSelf: Ember.computed.alias("user.viewingSelf"), - isGroup: Ember.computed.equal("pmView", "groups"), - currentPath: Ember.computed.alias("router._router.currentPath"), - selected: Ember.computed.alias("userTopicsList.selected"), - bulkSelectEnabled: Ember.computed.alias("userTopicsList.bulkSelectEnabled"), + viewingSelf: alias("user.viewingSelf"), + isGroup: equal("pmView", "groups"), + currentPath: alias("router._router.currentPath"), + selected: alias("userTopicsList.selected"), + bulkSelectEnabled: alias("userTopicsList.bulkSelectEnabled"), showToggleBulkSelect: true, - pmTaggingEnabled: Ember.computed.alias("site.can_tag_pms"), + pmTaggingEnabled: alias("site.can_tag_pms"), tagId: null, - showNewPM: Ember.computed.and( + showNewPM: and( "user.viewingSelf", "currentUser.can_send_private_messages" ), diff --git a/app/assets/javascripts/discourse/controllers/user-summary.js.es6 b/app/assets/javascripts/discourse/controllers/user-summary.js.es6 index 4dd6db5573c..7383cfa336f 100644 --- a/app/assets/javascripts/discourse/controllers/user-summary.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user-summary.js.es6 @@ -1,3 +1,4 @@ +import { alias } from "@ember/object/computed"; import { inject } from "@ember/controller"; import Controller from "@ember/controller"; import computed from "ember-addons/ember-computed-decorators"; @@ -8,7 +9,7 @@ const MAX_BADGES = 6; export default Controller.extend({ userController: inject("user"), - user: Ember.computed.alias("userController.model"), + user: alias("userController.model"), @computed("model.badges.length") moreBadges(badgesLength) { diff --git a/app/assets/javascripts/discourse/controllers/user.js.es6 b/app/assets/javascripts/discourse/controllers/user.js.es6 index 81ce8051bd2..3d4475db16d 100644 --- a/app/assets/javascripts/discourse/controllers/user.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user.js.es6 @@ -1,3 +1,4 @@ +import { alias, or, gt, not, and } from "@ember/object/computed"; import EmberObject from "@ember/object"; import { inject as service } from "@ember/service"; import { inject } from "@ember/controller"; @@ -12,7 +13,7 @@ export default Controller.extend(CanCheckEmails, { indexStream: false, router: service(), userNotifications: inject("user-notifications"), - currentPath: Ember.computed.alias("router._router.currentPath"), + currentPath: alias("router._router.currentPath"), adminTools: optionalService(), @computed("model.username") @@ -38,17 +39,17 @@ export default Controller.extend(CanCheckEmails, { } return (!indexStream || viewingSelf) && !forceExpand; }, - canMuteOrIgnoreUser: Ember.computed.or( + canMuteOrIgnoreUser: or( "model.can_ignore_user", "model.can_mute_user" ), - hasGivenFlags: Ember.computed.gt("model.number_of_flags_given", 0), - hasFlaggedPosts: Ember.computed.gt("model.number_of_flagged_posts", 0), - hasDeletedPosts: Ember.computed.gt("model.number_of_deleted_posts", 0), - hasBeenSuspended: Ember.computed.gt("model.number_of_suspensions", 0), - hasReceivedWarnings: Ember.computed.gt("model.warnings_received_count", 0), + hasGivenFlags: gt("model.number_of_flags_given", 0), + hasFlaggedPosts: gt("model.number_of_flagged_posts", 0), + hasDeletedPosts: gt("model.number_of_deleted_posts", 0), + hasBeenSuspended: gt("model.number_of_suspensions", 0), + hasReceivedWarnings: gt("model.warnings_received_count", 0), - showStaffCounters: Ember.computed.or( + showStaffCounters: or( "hasGivenFlags", "hasFlaggedPosts", "hasDeletedPosts", @@ -61,7 +62,7 @@ export default Controller.extend(CanCheckEmails, { return !suspended || isStaff; }, - linkWebsite: Ember.computed.not("model.isBasic"), + linkWebsite: not("model.isBasic"), @computed("model.trust_level") removeNoFollow(trustLevel) { @@ -105,7 +106,7 @@ export default Controller.extend(CanCheckEmails, { return User.currentProp("can_invite_to_forum"); }, - canDeleteUser: Ember.computed.and( + canDeleteUser: and( "model.can_be_deleted", "model.can_delete_all_posts" ), diff --git a/app/assets/javascripts/discourse/controllers/users.js.es6 b/app/assets/javascripts/discourse/controllers/users.js.es6 index 11521e68eb9..36e3236ffdc 100644 --- a/app/assets/javascripts/discourse/controllers/users.js.es6 +++ b/app/assets/javascripts/discourse/controllers/users.js.es6 @@ -1,3 +1,4 @@ +import { equal } from "@ember/object/computed"; import { inject } from "@ember/controller"; import Controller from "@ember/controller"; import debounce from "discourse/lib/debounce"; @@ -12,7 +13,7 @@ export default Controller.extend({ group: null, exclude_usernames: null, - showTimeRead: Ember.computed.equal("period", "all"), + showTimeRead: equal("period", "all"), _setName: debounce(function() { this.set("name", this.nameInput); diff --git a/app/assets/javascripts/discourse/mixins/bulk-topic-selection.js.es6 b/app/assets/javascripts/discourse/mixins/bulk-topic-selection.js.es6 index 15acb534544..311e47661de 100644 --- a/app/assets/javascripts/discourse/mixins/bulk-topic-selection.js.es6 +++ b/app/assets/javascripts/discourse/mixins/bulk-topic-selection.js.es6 @@ -1,3 +1,4 @@ +import { alias } from "@ember/object/computed"; import { NotificationLevels } from "discourse/lib/notification-levels"; import { on } from "ember-addons/ember-computed-decorators"; import Mixin from "@ember/object/mixin"; @@ -6,7 +7,7 @@ export default Mixin.create({ bulkSelectEnabled: false, selected: null, - canBulkSelect: Ember.computed.alias("currentUser.staff"), + canBulkSelect: alias("currentUser.staff"), @on("init") resetSelected() { diff --git a/app/assets/javascripts/discourse/mixins/can-check-emails.js.es6 b/app/assets/javascripts/discourse/mixins/can-check-emails.js.es6 index db18fbdd3e1..eed27ec9820 100644 --- a/app/assets/javascripts/discourse/mixins/can-check-emails.js.es6 +++ b/app/assets/javascripts/discourse/mixins/can-check-emails.js.es6 @@ -1,15 +1,16 @@ +import { and, alias, or } from "@ember/object/computed"; import { propertyEqual, setting } from "discourse/lib/computed"; import Mixin from "@ember/object/mixin"; export default Mixin.create({ isCurrentUser: propertyEqual("model.id", "currentUser.id"), showEmailOnProfile: setting("moderators_view_emails"), - canStaffCheckEmails: Ember.computed.and( + canStaffCheckEmails: and( "showEmailOnProfile", "currentUser.staff" ), - canAdminCheckEmails: Ember.computed.alias("currentUser.admin"), - canCheckEmails: Ember.computed.or( + canAdminCheckEmails: alias("currentUser.admin"), + canCheckEmails: or( "isCurrentUser", "canStaffCheckEmails", "canAdminCheckEmails" diff --git a/app/assets/javascripts/discourse/mixins/card-contents-base.js.es6 b/app/assets/javascripts/discourse/mixins/card-contents-base.js.es6 index 41adfa3b020..e9c0c0df563 100644 --- a/app/assets/javascripts/discourse/mixins/card-contents-base.js.es6 +++ b/app/assets/javascripts/discourse/mixins/card-contents-base.js.es6 @@ -1,3 +1,4 @@ +import { alias, match } from "@ember/object/computed"; import { throttle } from "@ember/runloop"; import { next } from "@ember/runloop"; import { schedule } from "@ember/runloop"; @@ -11,8 +12,8 @@ export default Mixin.create({ triggeringLinkClass: null, //the classname where this card should appear _showCallback: null, //username, $target - load up data for when show is called, should call this._positionCard($target) when it's done. - postStream: Ember.computed.alias("topic.postStream"), - viewingTopic: Ember.computed.match("currentPath", /^topic\./), + postStream: alias("topic.postStream"), + viewingTopic: match("currentPath", /^topic\./), visible: false, username: null, diff --git a/app/assets/javascripts/discourse/mixins/grant-badge-controller.js.es6 b/app/assets/javascripts/discourse/mixins/grant-badge-controller.js.es6 index 2ff5bdfe654..37502e37497 100644 --- a/app/assets/javascripts/discourse/mixins/grant-badge-controller.js.es6 +++ b/app/assets/javascripts/discourse/mixins/grant-badge-controller.js.es6 @@ -1,3 +1,4 @@ +import { empty } from "@ember/object/computed"; import computed from "ember-addons/ember-computed-decorators"; import UserBadge from "discourse/models/user-badge"; import { convertIconClass } from "discourse-common/lib/icon-library"; @@ -28,7 +29,7 @@ export default Mixin.create({ .sort((a, b) => a.get("name").localeCompare(b.get("name"))); }, - noGrantableBadges: Ember.computed.empty("grantableBadges"), + noGrantableBadges: empty("grantableBadges"), @computed("selectedBadgeId", "grantableBadges") selectedBadgeGrantable(selectedBadgeId, grantableBadges) { diff --git a/app/assets/javascripts/discourse/models/action-summary.js.es6 b/app/assets/javascripts/discourse/models/action-summary.js.es6 index 283a76981da..ce8259b9c00 100644 --- a/app/assets/javascripts/discourse/models/action-summary.js.es6 +++ b/app/assets/javascripts/discourse/models/action-summary.js.es6 @@ -1,9 +1,10 @@ +import { or } from "@ember/object/computed"; import { ajax } from "discourse/lib/ajax"; import RestModel from "discourse/models/rest"; import { popupAjaxError } from "discourse/lib/ajax-error"; export default RestModel.extend({ - canToggle: Ember.computed.or("can_undo", "can_act"), + canToggle: or("can_undo", "can_act"), // Remove it removeAction: function() { diff --git a/app/assets/javascripts/discourse/models/archetype.js.es6 b/app/assets/javascripts/discourse/models/archetype.js.es6 index 9ba6e6744b4..912a45b45c2 100644 --- a/app/assets/javascripts/discourse/models/archetype.js.es6 +++ b/app/assets/javascripts/discourse/models/archetype.js.es6 @@ -1,8 +1,9 @@ +import { gt, not } from "@ember/object/computed"; import { propertyEqual } from "discourse/lib/computed"; import RestModel from "discourse/models/rest"; export default RestModel.extend({ - hasOptions: Ember.computed.gt("options.length", 0), + hasOptions: gt("options.length", 0), isDefault: propertyEqual("id", "site.default_archetype"), - notDefault: Ember.computed.not("isDefault") + notDefault: not("isDefault") }); diff --git a/app/assets/javascripts/discourse/models/badge.js.es6 b/app/assets/javascripts/discourse/models/badge.js.es6 index ed1378ac3b4..ee0009246e4 100644 --- a/app/assets/javascripts/discourse/models/badge.js.es6 +++ b/app/assets/javascripts/discourse/models/badge.js.es6 @@ -1,3 +1,4 @@ +import { none } from "@ember/object/computed"; import EmberObject from "@ember/object"; import { ajax } from "discourse/lib/ajax"; import BadgeGrouping from "discourse/models/badge-grouping"; @@ -5,7 +6,7 @@ import RestModel from "discourse/models/rest"; import computed from "ember-addons/ember-computed-decorators"; const Badge = RestModel.extend({ - newBadge: Ember.computed.none("id"), + newBadge: none("id"), @computed url() { diff --git a/app/assets/javascripts/discourse/models/composer.js.es6 b/app/assets/javascripts/discourse/models/composer.js.es6 index 3a265ab342b..f7fc3d7746e 100644 --- a/app/assets/javascripts/discourse/models/composer.js.es6 +++ b/app/assets/javascripts/discourse/models/composer.js.es6 @@ -1,3 +1,4 @@ +import { reads, equal, not, or, and } from "@ember/object/computed"; import EmberObject from "@ember/object"; import { next } from "@ember/runloop"; import { cancel } from "@ember/runloop"; @@ -100,9 +101,9 @@ const Composer = RestModel.extend({ draftSaving: false, draftSaved: false, - archetypes: Ember.computed.reads("site.archetypes"), + archetypes: reads("site.archetypes"), - sharedDraft: Ember.computed.equal("action", CREATE_SHARED_DRAFT), + sharedDraft: equal("action", CREATE_SHARED_DRAFT), @computed categoryId: { @@ -140,11 +141,11 @@ const Composer = RestModel.extend({ : null; }, - creatingTopic: Ember.computed.equal("action", CREATE_TOPIC), - creatingSharedDraft: Ember.computed.equal("action", CREATE_SHARED_DRAFT), - creatingPrivateMessage: Ember.computed.equal("action", PRIVATE_MESSAGE), - notCreatingPrivateMessage: Ember.computed.not("creatingPrivateMessage"), - notPrivateMessage: Ember.computed.not("privateMessage"), + creatingTopic: equal("action", CREATE_TOPIC), + creatingSharedDraft: equal("action", CREATE_SHARED_DRAFT), + creatingPrivateMessage: equal("action", PRIVATE_MESSAGE), + notCreatingPrivateMessage: not("creatingPrivateMessage"), + notPrivateMessage: not("privateMessage"), @computed("editingPost", "topic.details.can_edit") disableTitleInput(editingPost, canEditTopic) { @@ -164,17 +165,17 @@ const Composer = RestModel.extend({ ); }, - topicFirstPost: Ember.computed.or("creatingTopic", "editingFirstPost"), + topicFirstPost: or("creatingTopic", "editingFirstPost"), @computed("action") editingPost: isEdit, - replyingToTopic: Ember.computed.equal("action", REPLY), + replyingToTopic: equal("action", REPLY), - viewOpen: Ember.computed.equal("composeState", OPEN), - viewDraft: Ember.computed.equal("composeState", DRAFT), - viewFullscreen: Ember.computed.equal("composeState", FULLSCREEN), - viewOpenOrFullscreen: Ember.computed.or("viewOpen", "viewFullscreen"), + viewOpen: equal("composeState", OPEN), + viewDraft: equal("composeState", DRAFT), + viewFullscreen: equal("composeState", FULLSCREEN), + viewOpenOrFullscreen: or("viewOpen", "viewFullscreen"), @observes("composeState") composeStateChanged() { @@ -232,16 +233,16 @@ const Composer = RestModel.extend({ false ), - editingFirstPost: Ember.computed.and("editingPost", "post.firstPost"), + editingFirstPost: and("editingPost", "post.firstPost"), - canEditTitle: Ember.computed.or( + canEditTitle: or( "creatingTopic", "creatingPrivateMessage", "editingFirstPost", "creatingSharedDraft" ), - canCategorize: Ember.computed.and( + canCategorize: and( "canEditTitle", "notCreatingPrivateMessage", "notPrivateMessage" diff --git a/app/assets/javascripts/discourse/models/group.js.es6 b/app/assets/javascripts/discourse/models/group.js.es6 index 27adb809f7b..3bc06e9d97e 100644 --- a/app/assets/javascripts/discourse/models/group.js.es6 +++ b/app/assets/javascripts/discourse/models/group.js.es6 @@ -1,3 +1,4 @@ +import { notEmpty, equal } from "@ember/object/computed"; import { ajax } from "discourse/lib/ajax"; import { default as computed, @@ -22,7 +23,7 @@ const Group = RestModel.extend({ this.set("owners", []); }, - hasOwners: Ember.computed.notEmpty("owners"), + hasOwners: notEmpty("owners"), @computed("automatic_membership_email_domains") emailDomains(value) { @@ -136,7 +137,7 @@ const Group = RestModel.extend({ : null; }, - canEveryoneMention: Ember.computed.equal("mentionable_level", 99), + canEveryoneMention: equal("mentionable_level", 99), @computed("visibility_level") isPrivate(visibilityLevel) { diff --git a/app/assets/javascripts/discourse/models/post-action-type.js.es6 b/app/assets/javascripts/discourse/models/post-action-type.js.es6 index fc83f6282a5..ef8541a1686 100644 --- a/app/assets/javascripts/discourse/models/post-action-type.js.es6 +++ b/app/assets/javascripts/discourse/models/post-action-type.js.es6 @@ -1,7 +1,8 @@ +import { not } from "@ember/object/computed"; import RestModel from "discourse/models/rest"; export const MAX_MESSAGE_LENGTH = 500; export default RestModel.extend({ - notCustomFlag: Ember.computed.not("is_custom_flag") + notCustomFlag: not("is_custom_flag") }); diff --git a/app/assets/javascripts/discourse/models/post-stream.js.es6 b/app/assets/javascripts/discourse/models/post-stream.js.es6 index a3b42bcaeb3..8ee59d23fe6 100644 --- a/app/assets/javascripts/discourse/models/post-stream.js.es6 +++ b/app/assets/javascripts/discourse/models/post-stream.js.es6 @@ -1,3 +1,4 @@ +import { or, not, and } from "@ember/object/computed"; import { ajax } from "discourse/lib/ajax"; import DiscourseURL from "discourse/lib/url"; import RestModel from "discourse/models/rest"; @@ -43,13 +44,13 @@ export default RestModel.extend({ }); }, - loading: Ember.computed.or( + loading: or( "loadingAbove", "loadingBelow", "loadingFilter", "stagingPost" ), - notLoading: Ember.computed.not("loading"), + notLoading: not("loading"), @computed("isMegaTopic", "stream.length", "topic.highest_post_number") filteredPostsCount(isMegaTopic, streamLength, topicHighestPostNumber) { @@ -66,12 +67,12 @@ export default RestModel.extend({ return hasPosts && filteredPostsCount > 0; }, - canAppendMore: Ember.computed.and( + canAppendMore: and( "notLoading", "hasPosts", "lastPostNotLoaded" ), - canPrependMore: Ember.computed.and( + canPrependMore: and( "notLoading", "hasPosts", "firstPostNotLoaded" @@ -85,7 +86,7 @@ export default RestModel.extend({ return !!this.posts.findBy("id", firstPostId); }, - firstPostNotLoaded: Ember.computed.not("firstPostPresent"), + firstPostNotLoaded: not("firstPostPresent"), firstId: null, lastId: null, @@ -112,7 +113,7 @@ export default RestModel.extend({ return !!this.posts.findBy("id", lastPostId); }, - lastPostNotLoaded: Ember.computed.not("loadedAllPosts"), + lastPostNotLoaded: not("loadedAllPosts"), /** Returns a JS Object of current stream filter options. It should match the query diff --git a/app/assets/javascripts/discourse/models/post.js.es6 b/app/assets/javascripts/discourse/models/post.js.es6 index 3e72627a10d..77fe18dc873 100644 --- a/app/assets/javascripts/discourse/models/post.js.es6 +++ b/app/assets/javascripts/discourse/models/post.js.es6 @@ -1,3 +1,4 @@ +import { equal, and, or, not } from "@ember/object/computed"; import EmberObject from "@ember/object"; import { ajax } from "discourse/lib/ajax"; import RestModel from "discourse/models/rest"; @@ -36,13 +37,13 @@ const Post = RestModel.extend({ } }, - new_user: Ember.computed.equal("trust_level", 0), - firstPost: Ember.computed.equal("post_number", 1), + new_user: equal("trust_level", 0), + firstPost: equal("post_number", 1), // Posts can show up as deleted if the topic is deleted - deletedViaTopic: Ember.computed.and("firstPost", "topic.deleted_at"), - deleted: Ember.computed.or("deleted_at", "deletedViaTopic"), - notDeleted: Ember.computed.not("deleted"), + deletedViaTopic: and("firstPost", "topic.deleted_at"), + deleted: or("deleted_at", "deletedViaTopic"), + notDeleted: not("deleted"), @computed("name", "username") showName(name, username) { diff --git a/app/assets/javascripts/discourse/models/rest.js.es6 b/app/assets/javascripts/discourse/models/rest.js.es6 index d9199082fd5..9ca2f5d0db6 100644 --- a/app/assets/javascripts/discourse/models/rest.js.es6 +++ b/app/assets/javascripts/discourse/models/rest.js.es6 @@ -1,8 +1,9 @@ +import { equal } from "@ember/object/computed"; import EmberObject from "@ember/object"; const RestModel = EmberObject.extend({ - isNew: Ember.computed.equal("__state", "new"), - isCreated: Ember.computed.equal("__state", "created"), + isNew: equal("__state", "new"), + isCreated: equal("__state", "created"), isSaving: false, beforeCreate() {}, diff --git a/app/assets/javascripts/discourse/models/reviewable-history.js.es6 b/app/assets/javascripts/discourse/models/reviewable-history.js.es6 index 0b1b14f54e0..dec1f37be5f 100644 --- a/app/assets/javascripts/discourse/models/reviewable-history.js.es6 +++ b/app/assets/javascripts/discourse/models/reviewable-history.js.es6 @@ -1,3 +1,4 @@ +import { equal } from "@ember/object/computed"; import RestModel from "discourse/models/rest"; export const CREATED = 0; @@ -5,5 +6,5 @@ export const TRANSITIONED_TO = 1; export const EDITED = 2; export default RestModel.extend({ - created: Ember.computed.equal("reviewable_history_type", CREATED) + created: equal("reviewable_history_type", CREATED) }); diff --git a/app/assets/javascripts/discourse/models/site.js.es6 b/app/assets/javascripts/discourse/models/site.js.es6 index 2c09a478d0a..46715900cd4 100644 --- a/app/assets/javascripts/discourse/models/site.js.es6 +++ b/app/assets/javascripts/discourse/models/site.js.es6 @@ -1,3 +1,4 @@ +import { alias, sort } from "@ember/object/computed"; import EmberObject from "@ember/object"; import computed from "ember-addons/ember-computed-decorators"; import Archetype from "discourse/models/archetype"; @@ -7,7 +8,7 @@ import RestModel from "discourse/models/rest"; import PreloadStore from "preload-store"; const Site = RestModel.extend({ - isReadOnly: Ember.computed.alias("is_readonly"), + isReadOnly: alias("is_readonly"), init() { this._super(...arguments); @@ -31,7 +32,7 @@ const Site = RestModel.extend({ return postActionTypes.filterBy("is_flag", true); }, - categoriesByCount: Ember.computed.sort("categories", "topicCountDesc"), + categoriesByCount: sort("categories", "topicCountDesc"), collectUserFields(fields) { fields = fields || {}; diff --git a/app/assets/javascripts/discourse/models/topic-list.js.es6 b/app/assets/javascripts/discourse/models/topic-list.js.es6 index 25834624b32..d9c9b211de1 100644 --- a/app/assets/javascripts/discourse/models/topic-list.js.es6 +++ b/app/assets/javascripts/discourse/models/topic-list.js.es6 @@ -1,3 +1,4 @@ +import { notEmpty } from "@ember/object/computed"; import EmberObject from "@ember/object"; import { ajax } from "discourse/lib/ajax"; import RestModel from "discourse/models/rest"; @@ -23,7 +24,7 @@ function displayCategoryInList(site, category) { } const TopicList = RestModel.extend({ - canLoadMore: Ember.computed.notEmpty("more_topics_url"), + canLoadMore: notEmpty("more_topics_url"), forEachNew(topics, callback) { const topicIds = []; diff --git a/app/assets/javascripts/discourse/models/topic.js.es6 b/app/assets/javascripts/discourse/models/topic.js.es6 index de72adeed84..ddfcf582829 100644 --- a/app/assets/javascripts/discourse/models/topic.js.es6 +++ b/app/assets/javascripts/discourse/models/topic.js.es6 @@ -1,3 +1,4 @@ +import { not, notEmpty, equal, and, or } from "@ember/object/computed"; import EmberObject from "@ember/object"; import { ajax } from "discourse/lib/ajax"; import { flushMap } from "discourse/models/store"; @@ -195,8 +196,8 @@ const Topic = RestModel.extend({ }); }, - invisible: Ember.computed.not("visible"), - deleted: Ember.computed.notEmpty("deleted_at"), + invisible: not("visible"), + deleted: notEmpty("deleted_at"), @computed("id") searchContext(id) { @@ -336,8 +337,8 @@ const Topic = RestModel.extend({ return Discourse.Site.currentProp("archetypes").findBy("id", archetype); }, - isPrivateMessage: Ember.computed.equal("archetype", "private_message"), - isBanner: Ember.computed.equal("archetype", "banner"), + isPrivateMessage: equal("archetype", "private_message"), + isBanner: equal("archetype", "banner"), toggleStatus(property) { this.toggleProperty(property); @@ -496,7 +497,7 @@ const Topic = RestModel.extend({ ); }, - isPinnedUncategorized: Ember.computed.and( + isPinnedUncategorized: and( "pinned", "category.isUncategorizedCategory" ), @@ -538,7 +539,7 @@ const Topic = RestModel.extend({ return emojiUnescape(excerpt); }, - hasExcerpt: Ember.computed.notEmpty("excerpt"), + hasExcerpt: notEmpty("excerpt"), @computed("excerpt") excerptTruncated(excerpt) { @@ -546,8 +547,8 @@ const Topic = RestModel.extend({ }, readLastPost: propertyEqual("last_read_post_number", "highest_post_number"), - canClearPin: Ember.computed.and("pinned", "readLastPost"), - canEditTags: Ember.computed.or("details.can_edit", "details.can_edit_tags"), + canClearPin: and("pinned", "readLastPost"), + canEditTags: or("details.can_edit", "details.can_edit_tags"), archiveMessage() { this.set("archiving", true); diff --git a/app/assets/javascripts/discourse/models/user-action.js.es6 b/app/assets/javascripts/discourse/models/user-action.js.es6 index 50600bc7fb6..dbbfcc4c2e2 100644 --- a/app/assets/javascripts/discourse/models/user-action.js.es6 +++ b/app/assets/javascripts/discourse/models/user-action.js.es6 @@ -1,3 +1,4 @@ +import { or, equal, and } from "@ember/object/computed"; import RestModel from "discourse/models/rest"; import { on } from "ember-addons/ember-computed-decorators"; import computed from "ember-addons/ember-computed-decorators"; @@ -75,9 +76,9 @@ const UserAction = RestModel.extend({ return targetUsername === Discourse.User.currentProp("username"); }, - presentName: Ember.computed.or("name", "username"), - targetDisplayName: Ember.computed.or("target_name", "target_username"), - actingDisplayName: Ember.computed.or("acting_name", "acting_username"), + presentName: or("name", "username"), + targetDisplayName: or("target_name", "target_username"), + actingDisplayName: or("acting_name", "acting_username"), @computed("target_username") targetUserUrl(username) { @@ -104,22 +105,22 @@ const UserAction = RestModel.extend({ return postUrl(this.slug, this.topic_id, this.reply_to_post_number); }, - replyType: Ember.computed.equal("action_type", UserActionTypes.replies), - postType: Ember.computed.equal("action_type", UserActionTypes.posts), - topicType: Ember.computed.equal("action_type", UserActionTypes.topics), - bookmarkType: Ember.computed.equal("action_type", UserActionTypes.bookmarks), - messageSentType: Ember.computed.equal( + replyType: equal("action_type", UserActionTypes.replies), + postType: equal("action_type", UserActionTypes.posts), + topicType: equal("action_type", UserActionTypes.topics), + bookmarkType: equal("action_type", UserActionTypes.bookmarks), + messageSentType: equal( "action_type", UserActionTypes.messages_sent ), - messageReceivedType: Ember.computed.equal( + messageReceivedType: equal( "action_type", UserActionTypes.messages_received ), - mentionType: Ember.computed.equal("action_type", UserActionTypes.mentions), - isPM: Ember.computed.or("messageSentType", "messageReceivedType"), - postReplyType: Ember.computed.or("postType", "replyType"), - removableBookmark: Ember.computed.and("bookmarkType", "sameUser"), + mentionType: equal("action_type", UserActionTypes.mentions), + isPM: or("messageSentType", "messageReceivedType"), + postReplyType: or("postType", "replyType"), + removableBookmark: and("bookmarkType", "sameUser"), addChild(action) { let groups = this.childGroups; diff --git a/app/assets/javascripts/discourse/models/user.js.es6 b/app/assets/javascripts/discourse/models/user.js.es6 index 57c8a070b13..88910cd58ef 100644 --- a/app/assets/javascripts/discourse/models/user.js.es6 +++ b/app/assets/javascripts/discourse/models/user.js.es6 @@ -1,3 +1,4 @@ +import { gt, equal, or } from "@ember/object/computed"; import EmberObject from "@ember/object"; import { ajax } from "discourse/lib/ajax"; import { url } from "discourse/lib/computed"; @@ -31,9 +32,9 @@ export const SECOND_FACTOR_METHODS = { const isForever = dt => moment().diff(dt, "years") < -500; const User = RestModel.extend({ - hasPMs: Ember.computed.gt("private_messages_stats.all", 0), - hasStartedPMs: Ember.computed.gt("private_messages_stats.mine", 0), - hasUnreadPMs: Ember.computed.gt("private_messages_stats.unread", 0), + hasPMs: gt("private_messages_stats.all", 0), + hasStartedPMs: gt("private_messages_stats.mine", 0), + hasUnreadPMs: gt("private_messages_stats.unread", 0), redirected_to_top: { reason: null @@ -204,10 +205,10 @@ const User = RestModel.extend({ ); }, - isBasic: Ember.computed.equal("trust_level", 0), - isLeader: Ember.computed.equal("trust_level", 3), - isElder: Ember.computed.equal("trust_level", 4), - canManageTopic: Ember.computed.or("staff", "isElder"), + isBasic: equal("trust_level", 0), + isLeader: equal("trust_level", 3), + isElder: equal("trust_level", 4), + canManageTopic: or("staff", "isElder"), @computed("previous_visit_at") previousVisitAt(previous_visit_at) { diff --git a/app/assets/javascripts/discourse/raw-views/list/post-count-or-badges.js.es6 b/app/assets/javascripts/discourse/raw-views/list/post-count-or-badges.js.es6 index 42356a4854b..d7c5f0aa068 100644 --- a/app/assets/javascripts/discourse/raw-views/list/post-count-or-badges.js.es6 +++ b/app/assets/javascripts/discourse/raw-views/list/post-count-or-badges.js.es6 @@ -1,9 +1,10 @@ +import { or, and } from "@ember/object/computed"; import EmberObject from "@ember/object"; import { default as computed } from "ember-addons/ember-computed-decorators"; export default EmberObject.extend({ - postCountsPresent: Ember.computed.or("topic.unread", "topic.displayNewPosts"), - showBadges: Ember.computed.and("postBadgesEnabled", "postCountsPresent"), + postCountsPresent: or("topic.unread", "topic.displayNewPosts"), + showBadges: and("postBadgesEnabled", "postCountsPresent"), @computed newDotText() { diff --git a/app/assets/javascripts/discourse/templates/components/reviewable-score.js.es6 b/app/assets/javascripts/discourse/templates/components/reviewable-score.js.es6 index 46f239534d4..291db6c2384 100644 --- a/app/assets/javascripts/discourse/templates/components/reviewable-score.js.es6 +++ b/app/assets/javascripts/discourse/templates/components/reviewable-score.js.es6 @@ -1,10 +1,11 @@ +import { gt } from "@ember/object/computed"; import Component from "@ember/component"; import computed from "ember-addons/ember-computed-decorators"; export default Component.extend({ tagName: "", - showStatus: Ember.computed.gt("rs.status", 0), + showStatus: gt("rs.status", 0), @computed("rs.score_type.title", "reviewable.target_created_by") title(title, targetCreatedBy) {