A platform for community discussion. Free, open, simple.
DEV: Removed all Ember.computed. in select-kit (#8322)
Mark VanLandingham7f3812b90a3d
diff --git a/app/assets/javascripts/select-kit/components/category-drop.js.es6 b/app/assets/javascripts/select-kit/components/category-drop.js.es6index 25f72b2655a..601d420d4b2 100644--- a/app/assets/javascripts/select-kit/components/category-drop.js.es6+++ b/app/assets/javascripts/select-kit/components/category-drop.js.es6@@ -1,3 +1,4 @@+import { alias, not } from "@ember/object/computed";import ComboBoxComponent from "select-kit/components/combo-box";import DiscourseURL from "discourse/lib/url";import { default as discourseComputed } from "discourse-common/utils/decorators";@@ -10,18 +11,18 @@ export default ComboBoxComponent.extend({classNameBindings: ["categoryStyle"],classNames: "category-drop",verticalOffset: 3,- content: Ember.computed.alias("categoriesWithShortcuts"),+ content: alias("categoriesWithShortcuts"),rowComponent: "category-row",headerComponent: "category-drop/category-drop-header",allowAutoSelectFirst: false,tagName: "li",- categoryStyle: Ember.computed.alias("siteSettings.category_style"),+ categoryStyle: alias("siteSettings.category_style"),noCategoriesLabel: I18n.t("categories.no_subcategory"),fullWidthOnMobile: true,caretDownIcon: "caret-right",caretUpIcon: "caret-down",subCategory: false,- isAsync: Ember.computed.not("subCategory"),+ isAsync: not("subCategory"),@discourseComputed("categories",diff --git a/app/assets/javascripts/select-kit/components/category-drop/category-drop-header.js.es6 b/app/assets/javascripts/select-kit/components/category-drop/category-drop-header.js.es6index ad86019a19e..c84b7189d0d 100644--- a/app/assets/javascripts/select-kit/components/category-drop/category-drop-header.js.es6+++ b/app/assets/javascripts/select-kit/components/category-drop/category-drop-header.js.es6@@ -1,3 +1,4 @@+import { alias } from "@ember/object/computed";import { isEmpty } from "@ember/utils";import ComboBoxSelectBoxHeaderComponent from "select-kit/components/combo-box/combo-box-header";import discourseComputed from "discourse-common/utils/decorators";@@ -9,7 +10,7 @@ export default ComboBoxSelectBoxHeaderComponent.extend({classNames: "category-drop-header",classNameBindings: ["categoryStyleClass"],- categoryStyleClass: Ember.computed.alias("site.category_style"),+ categoryStyleClass: alias("site.category_style"),@discourseComputed("computedContent.value", "computedContent.name")category(value, name) {diff --git a/app/assets/javascripts/select-kit/components/category-notifications-button.js.es6 b/app/assets/javascripts/select-kit/components/category-notifications-button.js.es6index 17c8e4de416..ecc000d8bdb 100644--- a/app/assets/javascripts/select-kit/components/category-notifications-button.js.es6+++ b/app/assets/javascripts/select-kit/components/category-notifications-button.js.es6@@ -1,10 +1,11 @@+import { or, alias } from "@ember/object/computed";import NotificationOptionsComponent from "select-kit/components/notifications-button";export default NotificationOptionsComponent.extend({pluginApiIdentifiers: ["category-notifications-button"],classNames: "category-notifications-button",- isHidden: Ember.computed.or("category.deleted"),- headerIcon: Ember.computed.alias("iconForSelectedDetails"),+ isHidden: or("category.deleted"),+ headerIcon: alias("iconForSelectedDetails"),i18nPrefix: "category.notifications",showFullTitle: false,allowInitialValueMutation: false,diff --git a/app/assets/javascripts/select-kit/components/category-row.js.es6 b/app/assets/javascripts/select-kit/components/category-row.js.es6index d2a548164ed..e8963e96b6d 100644--- a/app/assets/javascripts/select-kit/components/category-row.js.es6+++ b/app/assets/javascripts/select-kit/components/category-row.js.es6@@ -1,3 +1,4 @@+import { bool } from "@ember/object/computed";import { isEmpty } from "@ember/utils";import SelectKitRowComponent from "select-kit/components/select-kit/select-kit-row";import discourseComputed from "discourse-common/utils/decorators";@@ -8,9 +9,9 @@ export default SelectKitRowComponent.extend({layoutName: "select-kit/templates/components/category-row",classNames: "category-row",- hideParentCategory: Ember.computed.bool("options.hideParentCategory"),- allowUncategorized: Ember.computed.bool("options.allowUncategorized"),- categoryLink: Ember.computed.bool("options.categoryLink"),+ hideParentCategory: bool("options.hideParentCategory"),+ allowUncategorized: bool("options.allowUncategorized"),+ categoryLink: bool("options.categoryLink"),@discourseComputed("options.displayCategoryDescription")displayCategoryDescription(displayCategoryDescription) {diff --git a/app/assets/javascripts/select-kit/components/combo-box/combo-box-header.js.es6 b/app/assets/javascripts/select-kit/components/combo-box/combo-box-header.js.es6index 34e642bd7e0..f5bd5196257 100644--- a/app/assets/javascripts/select-kit/components/combo-box/combo-box-header.js.es6+++ b/app/assets/javascripts/select-kit/components/combo-box/combo-box-header.js.es6@@ -1,13 +1,14 @@+import { alias, and } from "@ember/object/computed";import SelectKitHeaderComponent from "select-kit/components/select-kit/select-kit-header";export default SelectKitHeaderComponent.extend({layoutName: "select-kit/templates/components/combo-box/combo-box-header",classNames: "combo-box-header",- clearable: Ember.computed.alias("options.clearable"),- caretUpIcon: Ember.computed.alias("options.caretUpIcon"),- caretDownIcon: Ember.computed.alias("options.caretDownIcon"),- shouldDisplayClearableButton: Ember.computed.and(+ clearable: alias("options.clearable"),+ caretUpIcon: alias("options.caretUpIcon"),+ caretDownIcon: alias("options.caretDownIcon"),+ shouldDisplayClearableButton: and("clearable","computedContent.hasSelection")diff --git a/app/assets/javascripts/select-kit/components/dropdown-select-box/dropdown-select-box-row.js.es6 b/app/assets/javascripts/select-kit/components/dropdown-select-box/dropdown-select-box-row.js.es6index 187fc460cbb..9bbe5fa3999 100644--- a/app/assets/javascripts/select-kit/components/dropdown-select-box/dropdown-select-box-row.js.es6+++ b/app/assets/javascripts/select-kit/components/dropdown-select-box/dropdown-select-box-row.js.es6@@ -1,3 +1,4 @@+import { alias } from "@ember/object/computed";import SelectKitRowComponent from "select-kit/components/select-kit/select-kit-row";export default SelectKitRowComponent.extend({@@ -5,7 +6,7 @@ export default SelectKitRowComponent.extend({"select-kit/templates/components/dropdown-select-box/dropdown-select-box-row",classNames: "dropdown-select-box-row",- description: Ember.computed.alias(+ description: alias("computedContent.originalContent.description")});diff --git a/app/assets/javascripts/select-kit/components/future-date-input-selector.js.es6 b/app/assets/javascripts/select-kit/components/future-date-input-selector.js.es6index f5167afb202..9fec1611c14 100644--- a/app/assets/javascripts/select-kit/components/future-date-input-selector.js.es6+++ b/app/assets/javascripts/select-kit/components/future-date-input-selector.js.es6@@ -1,3 +1,4 @@+import { equal } from "@ember/object/computed";import { isEmpty } from "@ember/utils";import ComboBoxComponent from "select-kit/components/combo-box";import { CLOSE_STATUS_TYPE } from "discourse/controllers/edit-topic-timer";@@ -188,8 +189,8 @@ export const FORMAT = "YYYY-MM-DD HH:mmZ";export default ComboBoxComponent.extend(DatetimeMixin, {pluginApiIdentifiers: ["future-date-input-selector"],classNames: ["future-date-input-selector"],- isCustom: Ember.computed.equal("value", "pick_date_and_time"),- isBasedOnLastPost: Ember.computed.equal("value", "set_based_on_last_post"),+ isCustom: equal("value", "pick_date_and_time"),+ isBasedOnLastPost: equal("value", "set_based_on_last_post"),rowComponent: "future-date-input-selector/future-date-input-selector-row",headerComponent:"future-date-input-selector/future-date-input-selector-header",diff --git a/app/assets/javascripts/select-kit/components/group-dropdown.js.es6 b/app/assets/javascripts/select-kit/components/group-dropdown.js.es6index a53988a953c..0e6ccfac0fe 100644--- a/app/assets/javascripts/select-kit/components/group-dropdown.js.es6+++ b/app/assets/javascripts/select-kit/components/group-dropdown.js.es6@@ -1,3 +1,4 @@+import { alias } from "@ember/object/computed";import ComboBoxComponent from "select-kit/components/combo-box";import DiscourseURL from "discourse/lib/url";import { default as discourseComputed } from "discourse-common/utils/decorators";@@ -5,7 +6,7 @@ import { default as discourseComputed } from "discourse-common/utils/decorators"export default ComboBoxComponent.extend({pluginApiIdentifiers: ["group-dropdown"],classNames: "group-dropdown",- content: Ember.computed.alias("groups"),+ content: alias("groups"),tagName: "li",caretDownIcon: "caret-right",caretUpIcon: "caret-down",diff --git a/app/assets/javascripts/select-kit/components/mini-tag-chooser.js.es6 b/app/assets/javascripts/select-kit/components/mini-tag-chooser.js.es6index 5a2fe7a73e8..1b4689b9333 100644--- a/app/assets/javascripts/select-kit/components/mini-tag-chooser.js.es6+++ b/app/assets/javascripts/select-kit/components/mini-tag-chooser.js.es6@@ -1,3 +1,4 @@+import { empty, alias } from "@ember/object/computed";import Category from "discourse/models/category";import ComboBox from "select-kit/components/combo-box";import TagsMixin from "select-kit/mixins/tags";@@ -19,11 +20,11 @@ export default ComboBox.extend(TagsMixin, {classNameBindings: ["noTags"],verticalOffset: 3,filterable: true,- noTags: Ember.computed.empty("selection"),+ noTags: empty("selection"),allowCreate: null,- allowAny: Ember.computed.alias("allowCreate"),- caretUpIcon: Ember.computed.alias("caretIcon"),- caretDownIcon: Ember.computed.alias("caretIcon"),+ allowAny: alias("allowCreate"),+ caretUpIcon: alias("caretIcon"),+ caretDownIcon: alias("caretIcon"),isAsync: true,fullWidthOnMobile: true,diff --git a/app/assets/javascripts/select-kit/components/multi-select/multi-select-header.js.es6 b/app/assets/javascripts/select-kit/components/multi-select/multi-select-header.js.es6index 67c3ac3f9e5..9b6c22f5274 100644--- a/app/assets/javascripts/select-kit/components/multi-select/multi-select-header.js.es6+++ b/app/assets/javascripts/select-kit/components/multi-select/multi-select-header.js.es6@@ -1,3 +1,4 @@+import { alias, or } from "@ember/object/computed";import { makeArray } from "discourse-common/lib/helpers";import { on } from "discourse-common/utils/decorators";import discourseComputed from "discourse-common/utils/decorators";@@ -13,13 +14,13 @@ export default SelectKitHeaderComponent.extend({classNames: "multi-select-header",layoutName:"select-kit/templates/components/multi-select/multi-select-header",- selectedNameComponent: Ember.computed.alias("options.selectedNameComponent"),+ selectedNameComponent: alias("options.selectedNameComponent"),- forceEscape: Ember.computed.alias("options.forceEscape"),+ forceEscape: alias("options.forceEscape"),- ariaLabel: Ember.computed.or("computedContent.ariaLabel", "title", "names"),+ ariaLabel: or("computedContent.ariaLabel", "title", "names"),- title: Ember.computed.or("computedContent.title", "names"),+ title: or("computedContent.title", "names"),@on("didRender")_positionFilter() {diff --git a/app/assets/javascripts/select-kit/components/multi-select/selected-name.js.es6 b/app/assets/javascripts/select-kit/components/multi-select/selected-name.js.es6index 6de8c9d0a8a..df37ac012c9 100644--- a/app/assets/javascripts/select-kit/components/multi-select/selected-name.js.es6+++ b/app/assets/javascripts/select-kit/components/multi-select/selected-name.js.es6@@ -1,3 +1,4 @@+import { or, alias } from "@ember/object/computed";import Component from "@ember/component";import discourseComputed from "discourse-common/utils/decorators";@@ -21,7 +22,7 @@ export default Component.extend({return Ember.guidFor(computedContent);},- ariaLabel: Ember.computed.or("computedContent.ariaLabel", "title"),+ ariaLabel: or("computedContent.ariaLabel", "title"),@discourseComputed("computedContent.title", "name")title(computedContentTitle, name) {@@ -31,11 +32,11 @@ export default Component.extend({return null;},- label: Ember.computed.or("computedContent.label", "title", "name"),+ label: or("computedContent.label", "title", "name"),- name: Ember.computed.alias("computedContent.name"),+ name: alias("computedContent.name"),- value: Ember.computed.alias("computedContent.value"),+ value: alias("computedContent.value"),isLocked: Ember.computed("computedContent.locked", function() {return this.getWithDefault("computedContent.locked", false);diff --git a/app/assets/javascripts/select-kit/components/notifications-button.js.es6 b/app/assets/javascripts/select-kit/components/notifications-button.js.es6index 5c5bec067bd..172282ba0b1 100644--- a/app/assets/javascripts/select-kit/components/notifications-button.js.es6+++ b/app/assets/javascripts/select-kit/components/notifications-button.js.es6@@ -1,3 +1,4 @@+import { alias } from "@ember/object/computed";import DropdownSelectBoxComponent from "select-kit/components/dropdown-select-box";import {default as discourseComputed,@@ -34,7 +35,7 @@ export default DropdownSelectBoxComponent.extend({});},- iconForSelectedDetails: Ember.computed.alias("selectedDetails.icon"),+ iconForSelectedDetails: alias("selectedDetails.icon"),computeHeaderContent() {let content = this._super(...arguments);diff --git a/app/assets/javascripts/select-kit/components/notifications-button/notifications-button-row.js.es6 b/app/assets/javascripts/select-kit/components/notifications-button/notifications-button-row.js.es6index e4a3b45bd5a..5d62a82e4bc 100644--- a/app/assets/javascripts/select-kit/components/notifications-button/notifications-button-row.js.es6+++ b/app/assets/javascripts/select-kit/components/notifications-button/notifications-button-row.js.es6@@ -1,3 +1,4 @@+import { alias } from "@ember/object/computed";import DropdownSelectBoxRoxComponent from "select-kit/components/dropdown-select-box/dropdown-select-box-row";import { buttonDetails } from "discourse/lib/notification-levels";import discourseComputed from "discourse-common/utils/decorators";@@ -6,8 +7,8 @@ import { iconHTML } from "discourse-common/lib/icon-library";export default DropdownSelectBoxRoxComponent.extend({classNames: "notifications-button-row",- i18nPrefix: Ember.computed.alias("options.i18nPrefix"),- i18nPostfix: Ember.computed.alias("options.i18nPostfix"),+ i18nPrefix: alias("options.i18nPrefix"),+ i18nPostfix: alias("options.i18nPostfix"),@discourseComputed("computedContent.value", "i18nPrefix", "i18nPostfix")title(value, prefix, postfix) {diff --git a/app/assets/javascripts/select-kit/components/period-chooser.js.es6 b/app/assets/javascripts/select-kit/components/period-chooser.js.es6index bc9befb89a4..60c6cd476a4 100644--- a/app/assets/javascripts/select-kit/components/period-chooser.js.es6+++ b/app/assets/javascripts/select-kit/components/period-chooser.js.es6@@ -1,3 +1,4 @@+import { oneWay, alias } from "@ember/object/computed";import DropdownSelectBoxComponent from "select-kit/components/dropdown-select-box";import discourseComputed, { on } from "discourse-common/utils/decorators";@@ -5,9 +6,9 @@ export default DropdownSelectBoxComponent.extend({classNames: ["period-chooser"],rowComponent: "period-chooser/period-chooser-row",headerComponent: "period-chooser/period-chooser-header",- content: Ember.computed.oneWay("site.periods"),- value: Ember.computed.alias("period"),- isHidden: Ember.computed.alias("showPeriods"),+ content: oneWay("site.periods"),+ value: alias("period"),+ isHidden: alias("showPeriods"),@discourseComputed("isExpanded")caretIcon(isExpanded) {diff --git a/app/assets/javascripts/select-kit/components/select-kit/select-kit-filter.js.es6 b/app/assets/javascripts/select-kit/components/select-kit/select-kit-filter.js.es6index a239c780cd5..7366fc884c5 100644--- a/app/assets/javascripts/select-kit/components/select-kit/select-kit-filter.js.es6+++ b/app/assets/javascripts/select-kit/components/select-kit/select-kit-filter.js.es6@@ -1,3 +1,4 @@+import { not } from "@ember/object/computed";import Component from "@ember/component";import discourseComputed from "discourse-common/utils/decorators";@@ -7,7 +8,7 @@ export default Component.extend({layoutName: "select-kit/templates/components/select-kit/select-kit-filter",classNames: ["select-kit-filter"],classNameBindings: ["isFocused", "isHidden"],- isHidden: Ember.computed.not("shouldDisplayFilter"),+ isHidden: not("shouldDisplayFilter"),@discourseComputed("placeholder")discourseComputedPlaceholder(placeholder) {diff --git a/app/assets/javascripts/select-kit/components/select-kit/select-kit-header.js.es6 b/app/assets/javascripts/select-kit/components/select-kit/select-kit-header.js.es6index fd145162d0e..525c9b69366 100644--- a/app/assets/javascripts/select-kit/components/select-kit/select-kit-header.js.es6+++ b/app/assets/javascripts/select-kit/components/select-kit/select-kit-header.js.es6@@ -1,3 +1,4 @@+import { alias, none, or } from "@ember/object/computed";import Component from "@ember/component";import discourseComputed from "discourse-common/utils/decorators";@@ -16,13 +17,13 @@ export default Component.extend({"name:data-name"],- forceEscape: Ember.computed.alias("options.forceEscape"),+ forceEscape: alias("options.forceEscape"),- isNone: Ember.computed.none("computedContent.value"),+ isNone: none("computedContent.value"),ariaHasPopup: "true",- ariaLabel: Ember.computed.or("computedContent.ariaLabel", "sanitizedTitle"),+ ariaLabel: or("computedContent.ariaLabel", "sanitizedTitle"),@discourseComputed("computedContent.title", "name")title(computedContentTitle, name) {@@ -39,11 +40,11 @@ export default Component.extend({return String(title).replace("…", "");},- label: Ember.computed.or("computedContent.label", "title", "name"),+ label: or("computedContent.label", "title", "name"),- name: Ember.computed.alias("computedContent.name"),+ name: alias("computedContent.name"),- value: Ember.computed.alias("computedContent.value"),+ value: alias("computedContent.value"),@discourseComputed("computedContent.icon", "computedContent.icons")icons(icon, icons) {diff --git a/app/assets/javascripts/select-kit/components/select-kit/select-kit-row.js.es6 b/app/assets/javascripts/select-kit/components/select-kit/select-kit-row.js.es6index 01828a5e946..a50db81e0a1 100644--- a/app/assets/javascripts/select-kit/components/select-kit/select-kit-row.js.es6+++ b/app/assets/javascripts/select-kit/components/select-kit/select-kit-row.js.es6@@ -1,3 +1,4 @@+import { alias, or } from "@ember/object/computed";import Component from "@ember/component";import {default as discourseComputed,@@ -26,9 +27,9 @@ export default Component.extend(UtilsMixin, {"computedContent.originalContent.classNames"],- forceEscape: Ember.computed.alias("options.forceEscape"),+ forceEscape: alias("options.forceEscape"),- ariaLabel: Ember.computed.or("computedContent.ariaLabel", "title"),+ ariaLabel: or("computedContent.ariaLabel", "title"),@discourseComputed("computedContent.title", "name")title(computedContentTitle, name) {@@ -43,11 +44,11 @@ export default Component.extend(UtilsMixin, {return Ember.guidFor(computedContent);},- label: Ember.computed.or("computedContent.label", "title", "name"),+ label: or("computedContent.label", "title", "name"),- name: Ember.computed.alias("computedContent.name"),+ name: alias("computedContent.name"),- value: Ember.computed.alias("computedContent.value"),+ value: alias("computedContent.value"),@discourseComputed("templateForRow")template(templateForRow) {diff --git a/app/assets/javascripts/select-kit/components/tag-chooser.js.es6 b/app/assets/javascripts/select-kit/components/tag-chooser.js.es6index 1ad21b06424..247a8eeab10 100644--- a/app/assets/javascripts/select-kit/components/tag-chooser.js.es6+++ b/app/assets/javascripts/select-kit/components/tag-chooser.js.es6@@ -1,3 +1,4 @@+import { alias } from "@ember/object/computed";import MultiSelectComponent from "select-kit/components/multi-select";import TagsMixin from "select-kit/mixins/tags";import renderTag from "discourse/lib/render-tag";@@ -15,7 +16,7 @@ export default MultiSelectComponent.extend(TagsMixin, {blacklist: null,attributeBindings: ["categoryId"],allowCreate: null,- allowAny: Ember.computed.alias("allowCreate"),+ allowAny: alias("allowCreate"),init() {this._super(...arguments);diff --git a/app/assets/javascripts/select-kit/components/tag-drop.js.es6 b/app/assets/javascripts/select-kit/components/tag-drop.js.es6index 9fbce57f855..4fbea17f54b 100644--- a/app/assets/javascripts/select-kit/components/tag-drop.js.es6+++ b/app/assets/javascripts/select-kit/components/tag-drop.js.es6@@ -1,3 +1,4 @@+import { alias, or } from "@ember/object/computed";import { makeArray } from "discourse-common/lib/helpers";import ComboBoxComponent from "select-kit/components/combo-box";import DiscourseURL from "discourse/lib/url";@@ -10,14 +11,14 @@ export default ComboBoxComponent.extend(TagsMixin, {classNameBindings: ["categoryStyle", "tagClass"],classNames: "tag-drop",verticalOffset: 3,- value: Ember.computed.alias("tagId"),+ value: alias("tagId"),headerComponent: "tag-drop/tag-drop-header",allowAutoSelectFirst: false,tagName: "li",- showFilterByTag: Ember.computed.alias("siteSettings.show_filter_by_tag"),- currentCategory: Ember.computed.or("secondCategory", "firstCategory"),+ showFilterByTag: alias("siteSettings.show_filter_by_tag"),+ currentCategory: or("secondCategory", "firstCategory"),tagId: null,- categoryStyle: Ember.computed.alias("siteSettings.category_style"),+ categoryStyle: alias("siteSettings.category_style"),mutateAttributes() {},fullWidthOnMobile: true,caretDownIcon: "caret-right",diff --git a/app/assets/javascripts/select-kit/components/toolbar-popup-menu-options.js.es6 b/app/assets/javascripts/select-kit/components/toolbar-popup-menu-options.js.es6index 0c0ab1f730d..8e25330942a 100644--- a/app/assets/javascripts/select-kit/components/toolbar-popup-menu-options.js.es6+++ b/app/assets/javascripts/select-kit/components/toolbar-popup-menu-options.js.es6@@ -1,10 +1,11 @@+import { empty } from "@ember/object/computed";import DropdownSelectBoxComponent from "select-kit/components/dropdown-select-box";import discourseComputed from "discourse-common/utils/decorators";export default DropdownSelectBoxComponent.extend({pluginApiIdentifiers: ["toolbar-popup-menu-options"],classNames: ["toolbar-popup-menu-options"],- isHidden: Ember.computed.empty("computedContent"),+ isHidden: empty("computedContent"),showFullTitle: false,@discourseComputed("title")diff --git a/app/assets/javascripts/select-kit/components/topic-footer-mobile-dropdown.js.es6 b/app/assets/javascripts/select-kit/components/topic-footer-mobile-dropdown.js.es6index 178caa43b54..07d665486c6 100644--- a/app/assets/javascripts/select-kit/components/topic-footer-mobile-dropdown.js.es6+++ b/app/assets/javascripts/select-kit/components/topic-footer-mobile-dropdown.js.es6@@ -1,3 +1,4 @@+import { empty } from "@ember/object/computed";import ComboBoxComponent from "select-kit/components/combo-box";export default ComboBoxComponent.extend({@@ -8,7 +9,7 @@ export default ComboBoxComponent.extend({allowInitialValueMutation: false,allowAutoSelectFirst: false,nameProperty: "label",- isHidden: Ember.computed.empty("content"),+ isHidden: empty("content"),computeHeaderContent() {const content = this._super(...arguments);