DEV: Import every instance of Ember.computed function (#8267)
* DEV: Import every instance of Ember.computed function * export default for Ember.computed
This commit is contained in:
parent
790a7e2095
commit
2ae21e9c35
|
@ -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)$/
|
||||
),
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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")
|
||||
});
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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"),
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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")) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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 };
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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")
|
||||
});
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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)?:\/\//
|
||||
),
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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,
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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"
|
||||
),
|
||||
|
|
|
@ -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"
|
||||
),
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) };
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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)));
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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 },
|
||||
|
|
|
@ -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")
|
||||
});
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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)
|
||||
});
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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)
|
||||
});
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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"
|
||||
),
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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,
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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")
|
||||
});
|
||||
|
|
|
@ -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")
|
||||
});
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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"
|
||||
),
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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) {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue