From f5180656540084cddcb3e4072d7ae9e4aa333ee4 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 13 Nov 2019 11:57:42 -0500 Subject: [PATCH] FIX: computed is part of `@ember/object` not `@ember/object/computed` --- .../admin/controllers/admin-dashboard-general.js.es6 | 2 +- app/assets/javascripts/admin/models/api-key.js.es6 | 2 +- app/assets/javascripts/discourse-loader.js | 4 ++-- app/assets/javascripts/discourse.js.es6 | 2 +- .../discourse/components/about-page-users.js.es6 | 2 +- .../discourse/components/date-time-input.js.es6 | 2 +- .../javascripts/discourse/controllers/composer.js.es6 | 10 ++-------- .../javascripts/discourse/controllers/history.js.es6 | 10 ++-------- .../discourse/lib/register-topic-footer-button.js.es6 | 2 +- .../discourse/mixins/buffered-content.js.es6 | 2 +- app/assets/javascripts/discourse/models/post.js.es6 | 10 ++-------- app/assets/javascripts/discourse/models/user.js.es6 | 4 ++-- .../discourse/widgets/post-small-action.js.es6 | 2 +- .../components/multi-select/selected-name.js.es6 | 3 ++- .../initializers/add-poll-ui-builder.js.es6 | 4 ++-- 15 files changed, 22 insertions(+), 39 deletions(-) diff --git a/app/assets/javascripts/admin/controllers/admin-dashboard-general.js.es6 b/app/assets/javascripts/admin/controllers/admin-dashboard-general.js.es6 index ea7dc31dde2..b77e3e02884 100644 --- a/app/assets/javascripts/admin/controllers/admin-dashboard-general.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-dashboard-general.js.es6 @@ -6,7 +6,7 @@ import { setting } from "discourse/lib/computed"; import AdminDashboard from "admin/models/admin-dashboard"; import Report from "admin/models/report"; import PeriodComputationMixin from "admin/mixins/period-computation"; -import computed from "@ember/object/computed"; +import { computed } from "@ember/object"; function staticReport(reportType) { return computed("reports.[]", function() { diff --git a/app/assets/javascripts/admin/models/api-key.js.es6 b/app/assets/javascripts/admin/models/api-key.js.es6 index bc818fb8e22..7a20c288aea 100644 --- a/app/assets/javascripts/admin/models/api-key.js.es6 +++ b/app/assets/javascripts/admin/models/api-key.js.es6 @@ -2,7 +2,7 @@ import discourseComputed from "discourse-common/utils/decorators"; import AdminUser from "admin/models/admin-user"; import RestModel from "discourse/models/rest"; import { ajax } from "discourse/lib/ajax"; -import computed from "@ember/object/computed"; +import { computed } from "@ember/object"; const ApiKey = RestModel.extend({ user: computed("_user", { diff --git a/app/assets/javascripts/discourse-loader.js b/app/assets/javascripts/discourse-loader.js index fdef7d3cd9e..6b8f90de229 100644 --- a/app/assets/javascripts/discourse-loader.js +++ b/app/assets/javascripts/discourse-loader.js @@ -20,10 +20,10 @@ var define, requirejs; get: Ember.get, getProperties: Ember.getProperties, set: Ember.set, - setProperties: Ember.setProperties + setProperties: Ember.setProperties, + computed: Ember.computed }, "@ember/object/computed": { - default: Ember.computed, alias: Ember.computed.alias, and: Ember.computed.and, bool: Ember.computed.bool, diff --git a/app/assets/javascripts/discourse.js.es6 b/app/assets/javascripts/discourse.js.es6 index 25d2f74ec8b..42340cdfadc 100644 --- a/app/assets/javascripts/discourse.js.es6 +++ b/app/assets/javascripts/discourse.js.es6 @@ -4,7 +4,7 @@ import { default as discourseComputed, observes } from "discourse-common/utils/decorators"; -import computed from "@ember/object/computed"; +import { computed } from "@ember/object"; import FocusEvent from "discourse-common/mixins/focus-event"; import EmberObject from "@ember/object"; import deprecated from "discourse-common/lib/deprecated"; diff --git a/app/assets/javascripts/discourse/components/about-page-users.js.es6 b/app/assets/javascripts/discourse/components/about-page-users.js.es6 index e064c67f290..59db7aee75b 100644 --- a/app/assets/javascripts/discourse/components/about-page-users.js.es6 +++ b/app/assets/javascripts/discourse/components/about-page-users.js.es6 @@ -3,7 +3,7 @@ import { userPath } from "discourse/lib/url"; import { formatUsername, escapeExpression } from "discourse/lib/utilities"; import { normalize } from "discourse/components/user-info"; import { renderAvatar } from "discourse/helpers/user-avatar"; -import computed from "@ember/object/computed"; +import { computed } from "@ember/object"; export default Component.extend({ usersTemplates: computed("users.[]", function() { diff --git a/app/assets/javascripts/discourse/components/date-time-input.js.es6 b/app/assets/javascripts/discourse/components/date-time-input.js.es6 index e6dc3d481b3..e9c7ad73975 100644 --- a/app/assets/javascripts/discourse/components/date-time-input.js.es6 +++ b/app/assets/javascripts/discourse/components/date-time-input.js.es6 @@ -1,5 +1,5 @@ import Component from "@ember/component"; -import computed from "@ember/object/computed"; +import { computed } from "@ember/object"; export default Component.extend({ classNames: ["d-date-time-input"], diff --git a/app/assets/javascripts/discourse/controllers/composer.js.es6 b/app/assets/javascripts/discourse/controllers/composer.js.es6 index 90e0429aaa2..2289470cfa9 100644 --- a/app/assets/javascripts/discourse/controllers/composer.js.es6 +++ b/app/assets/javascripts/discourse/controllers/composer.js.es6 @@ -1,11 +1,5 @@ import { isEmpty } from "@ember/utils"; -import { - default as computed, - and, - or, - alias, - reads -} from "@ember/object/computed"; +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"; @@ -31,7 +25,7 @@ import { shortDate } from "discourse/lib/formatter"; import { SAVE_LABELS, SAVE_ICONS } from "discourse/models/composer"; import { Promise } from "rsvp"; import ENV from "discourse-common/config/environment"; -import EmberObject from "@ember/object"; +import EmberObject, { computed } from "@ember/object"; function loadDraft(store, opts) { opts = opts || {}; diff --git a/app/assets/javascripts/discourse/controllers/history.js.es6 b/app/assets/javascripts/discourse/controllers/history.js.es6 index 99a5b2194d0..c1ec7fc42c0 100644 --- a/app/assets/javascripts/discourse/controllers/history.js.es6 +++ b/app/assets/javascripts/discourse/controllers/history.js.es6 @@ -1,12 +1,5 @@ import discourseComputed from "discourse-common/utils/decorators"; -import { - default as computed, - alias, - gt, - not, - or, - equal -} from "@ember/object/computed"; +import { alias, gt, not, or, equal } from "@ember/object/computed"; import Controller from "@ember/controller"; import ModalFunctionality from "discourse/mixins/modal-functionality"; import { categoryBadgeHTML } from "discourse/helpers/category-link"; @@ -16,6 +9,7 @@ import { sanitizeAsync } from "discourse/lib/text"; import { iconHTML } from "discourse-common/lib/icon-library"; import Post from "discourse/models/post"; import Category from "discourse/models/category"; +import computed from "@ember/object"; function customTagArray(fieldName) { return computed(fieldName, function() { diff --git a/app/assets/javascripts/discourse/lib/register-topic-footer-button.js.es6 b/app/assets/javascripts/discourse/lib/register-topic-footer-button.js.es6 index fa72ebee6eb..c2dd9eb96cf 100644 --- a/app/assets/javascripts/discourse/lib/register-topic-footer-button.js.es6 +++ b/app/assets/javascripts/discourse/lib/register-topic-footer-button.js.es6 @@ -1,5 +1,5 @@ import error from "@ember/error"; -import computed from "@ember/object/computed"; +import { computed } from "@ember/object"; let _topicFooterButtons = {}; diff --git a/app/assets/javascripts/discourse/mixins/buffered-content.js.es6 b/app/assets/javascripts/discourse/mixins/buffered-content.js.es6 index 1e5de0f9ef2..beb145a3ec2 100644 --- a/app/assets/javascripts/discourse/mixins/buffered-content.js.es6 +++ b/app/assets/javascripts/discourse/mixins/buffered-content.js.es6 @@ -1,6 +1,6 @@ import EmberObjectProxy from "@ember/object/proxy"; import Mixin from "@ember/object/mixin"; -import computed from "@ember/object/computed"; +import { computed } from "@ember/object"; /* global BufferedProxy: true */ export function bufferedProperty(property) { diff --git a/app/assets/javascripts/discourse/models/post.js.es6 b/app/assets/javascripts/discourse/models/post.js.es6 index eda9bed816a..eebd4f67ecd 100644 --- a/app/assets/javascripts/discourse/models/post.js.es6 +++ b/app/assets/javascripts/discourse/models/post.js.es6 @@ -1,13 +1,7 @@ import discourseComputed from "discourse-common/utils/decorators"; -import { get } from "@ember/object"; +import { computed, get } from "@ember/object"; import { isEmpty } from "@ember/utils"; -import { - default as computed, - equal, - and, - or, - not -} from "@ember/object/computed"; +import { equal, and, or, not } from "@ember/object/computed"; import EmberObject from "@ember/object"; import { ajax } from "discourse/lib/ajax"; import RestModel from "discourse/models/rest"; diff --git a/app/assets/javascripts/discourse/models/user.js.es6 b/app/assets/javascripts/discourse/models/user.js.es6 index a5c3ae776a6..2906dee77fa 100644 --- a/app/assets/javascripts/discourse/models/user.js.es6 +++ b/app/assets/javascripts/discourse/models/user.js.es6 @@ -1,6 +1,6 @@ import { isEmpty } from "@ember/utils"; -import { default as computed, gt, equal, or } from "@ember/object/computed"; -import EmberObject from "@ember/object"; +import { gt, equal, or } from "@ember/object/computed"; +import EmberObject, { computed } from "@ember/object"; import { ajax } from "discourse/lib/ajax"; import { url } from "discourse/lib/computed"; import RestModel from "discourse/models/rest"; diff --git a/app/assets/javascripts/discourse/widgets/post-small-action.js.es6 b/app/assets/javascripts/discourse/widgets/post-small-action.js.es6 index 93fadb5c246..709d70153a9 100644 --- a/app/assets/javascripts/discourse/widgets/post-small-action.js.es6 +++ b/app/assets/javascripts/discourse/widgets/post-small-action.js.es6 @@ -5,7 +5,7 @@ import { h } from "virtual-dom"; import { avatarFor } from "discourse/widgets/post"; import { userPath } from "discourse/lib/url"; import { autoUpdatingRelativeAge } from "discourse/lib/formatter"; -import computed from "@ember/object/computed"; +import { computed } from "@ember/object"; export function actionDescriptionHtml(actionCode, createdAt, username) { const dt = new Date(createdAt); 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.es6 index f5736ee6099..ab6a36c36cd 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,6 +1,7 @@ -import { default as computed, or, alias } from "@ember/object/computed"; +import { or, alias } from "@ember/object/computed"; import Component from "@ember/component"; import discourseComputed from "discourse-common/utils/decorators"; +import { computed } from "@ember/object"; export default Component.extend({ attributeBindings: [ diff --git a/plugins/poll/assets/javascripts/initializers/add-poll-ui-builder.js.es6 b/plugins/poll/assets/javascripts/initializers/add-poll-ui-builder.js.es6 index 406045f1ffd..d9da92d2526 100644 --- a/plugins/poll/assets/javascripts/initializers/add-poll-ui-builder.js.es6 +++ b/plugins/poll/assets/javascripts/initializers/add-poll-ui-builder.js.es6 @@ -1,10 +1,10 @@ import { withPluginApi } from "discourse/lib/plugin-api"; -import computed from "ember-addons/ember-computed-decorators"; +import discourseComputed from "discourse-common/utils/decorators"; import showModal from "discourse/lib/show-modal"; function initializePollUIBuilder(api) { api.modifyClass("controller:composer", { - @computed( + @discourseComputed( "siteSettings.poll_enabled", "siteSettings.poll_minimum_trust_level_to_create", "model.topic.pm_with_non_human_user"