From ef6b7bd77614152e98057a5f37678e635d1b9ae7 Mon Sep 17 00:00:00 2001 From: Jarek Radosz Date: Fri, 6 Mar 2020 17:41:41 +0100 Subject: [PATCH] DEV: Use aliased `inject` imports (#9086) This is a common Ember idiom for easier differentiation between controller and service imports. --- .../admin/controllers/admin-backups-index.js.es6 | 5 ++--- .../admin/controllers/admin-backups-logs.js.es6 | 6 +++--- .../admin/controllers/admin-badges-show.js.es6 | 4 ++-- .../admin-site-settings-category.js.es6 | 5 ++--- .../admin/controllers/admin-user-badges.js.es6 | 5 ++--- .../controllers/admin-watched-words-action.js.es6 | 5 ++--- .../admin/controllers/admin-web-hooks-show.js.es6 | 5 ++--- .../controllers/modals/admin-add-upload.js.es6 | 5 ++--- .../modals/admin-color-scheme-select-base.js.es6 | 5 ++--- .../controllers/modals/admin-install-theme.js.es6 | 7 +++---- .../controllers/modals/admin-start-backup.js.es6 | 5 ++--- .../discourse/controllers/activation-edit.js.es6 | 5 ++--- .../discourse/controllers/badges/show.js.es6 | 5 ++--- .../controllers/bulk-notification-level.js.es6 | 5 ++--- .../discourse/controllers/create-account.js.es6 | 5 ++--- .../discourse/controllers/discovery.js.es6 | 9 ++++----- .../controllers/discovery/categories.js.es6 | 4 ++-- .../discourse/controllers/discovery/topics.js.es6 | 6 +++--- .../discourse/controllers/full-page-search.js.es6 | 7 +++---- .../controllers/group-activity-posts.js.es6 | 9 ++++----- .../discourse/controllers/group-index.js.es6 | 4 ++-- .../controllers/group-manage-logs.js.es6 | 7 +++---- .../discourse/controllers/group-requests.js.es6 | 4 ++-- .../discourse/controllers/group.js.es6 | 5 ++--- .../discourse/controllers/groups-index.js.es6 | 5 ++--- .../discourse/controllers/login.js.es6 | 9 ++++----- .../controllers/navigation/default.js.es6 | 7 +++---- .../discourse/controllers/static.js.es6 | 5 ++--- .../discourse/controllers/tag-groups-edit.js.es6 | 5 ++--- .../discourse/controllers/tag-groups-new.js.es6 | 4 ++-- .../discourse/controllers/tags-show.js.es6 | 5 ++--- .../discourse/controllers/topic.js.es6 | 15 +++++++-------- .../discourse/controllers/user-activity.js.es6 | 7 +++---- .../discourse/controllers/user-badges.js.es6 | 6 +++--- .../discourse/controllers/user-card.js.es6 | 5 ++--- .../controllers/user-notifications.js.es6 | 5 ++--- .../discourse/controllers/user-posts.js.es6 | 5 ++--- .../controllers/user-private-messages.js.es6 | 7 +++---- .../discourse/controllers/user-topics-list.js.es6 | 5 ++--- .../discourse/controllers/users.js.es6 | 5 ++--- 40 files changed, 100 insertions(+), 132 deletions(-) diff --git a/app/assets/javascripts/admin/controllers/admin-backups-index.js.es6 b/app/assets/javascripts/admin/controllers/admin-backups-index.js.es6 index 01103105e84..45f25dd617d 100644 --- a/app/assets/javascripts/admin/controllers/admin-backups-index.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-backups-index.js.es6 @@ -1,12 +1,11 @@ import { alias, equal } from "@ember/object/computed"; -import { inject } from "@ember/controller"; -import Controller from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; import { ajax } from "discourse/lib/ajax"; import discourseComputed from "discourse-common/utils/decorators"; import { setting, i18n } from "discourse/lib/computed"; export default Controller.extend({ - adminBackups: inject(), + adminBackups: controller(), status: alias("adminBackups.model"), uploadLabel: i18n("admin.backups.upload.label"), backupLocation: setting("backup_location"), diff --git a/app/assets/javascripts/admin/controllers/admin-backups-logs.js.es6 b/app/assets/javascripts/admin/controllers/admin-backups-logs.js.es6 index a32e2162553..69a81f9b676 100644 --- a/app/assets/javascripts/admin/controllers/admin-backups-logs.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-backups-logs.js.es6 @@ -1,8 +1,8 @@ import { alias } from "@ember/object/computed"; -import { inject } from "@ember/controller"; -import Controller from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; + export default Controller.extend({ - adminBackups: inject(), + adminBackups: controller(), status: alias("adminBackups.model"), init() { diff --git a/app/assets/javascripts/admin/controllers/admin-badges-show.js.es6 b/app/assets/javascripts/admin/controllers/admin-badges-show.js.es6 index 0586a33505d..a860d2f992d 100644 --- a/app/assets/javascripts/admin/controllers/admin-badges-show.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-badges-show.js.es6 @@ -1,13 +1,13 @@ import discourseComputed, { observes } from "discourse-common/utils/decorators"; import { reads } from "@ember/object/computed"; -import Controller, { inject } from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; import { popupAjaxError } from "discourse/lib/ajax-error"; import { bufferedProperty } from "discourse/mixins/buffered-content"; import { propertyNotEqual } from "discourse/lib/computed"; import { run } from "@ember/runloop"; export default Controller.extend(bufferedProperty("model"), { - adminBadges: inject(), + adminBadges: controller(), saving: false, savingStatus: "", badgeTypes: reads("adminBadges.badgeTypes"), diff --git a/app/assets/javascripts/admin/controllers/admin-site-settings-category.js.es6 b/app/assets/javascripts/admin/controllers/admin-site-settings-category.js.es6 index bfd727e6ead..b2c29730ec2 100644 --- a/app/assets/javascripts/admin/controllers/admin-site-settings-category.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-site-settings-category.js.es6 @@ -1,10 +1,9 @@ import discourseComputed from "discourse-common/utils/decorators"; -import { inject } from "@ember/controller"; -import Controller from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; export default Controller.extend({ + adminSiteSettings: controller(), categoryNameKey: null, - adminSiteSettings: inject(), @discourseComputed("adminSiteSettings.visibleSiteSettings", "categoryNameKey") category(categories, nameKey) { diff --git a/app/assets/javascripts/admin/controllers/admin-user-badges.js.es6 b/app/assets/javascripts/admin/controllers/admin-user-badges.js.es6 index 3bedafb45ce..a42bf58ca53 100644 --- a/app/assets/javascripts/admin/controllers/admin-user-badges.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-user-badges.js.es6 @@ -1,13 +1,12 @@ import discourseComputed from "discourse-common/utils/decorators"; import { alias, sort } from "@ember/object/computed"; import { next } from "@ember/runloop"; -import { inject } from "@ember/controller"; -import Controller from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; import GrantBadgeController from "discourse/mixins/grant-badge-controller"; import { popupAjaxError } from "discourse/lib/ajax-error"; export default Controller.extend(GrantBadgeController, { - adminUser: inject(), + adminUser: controller(), user: alias("adminUser.model"), userBadges: alias("model"), allBadges: alias("badges"), diff --git a/app/assets/javascripts/admin/controllers/admin-watched-words-action.js.es6 b/app/assets/javascripts/admin/controllers/admin-watched-words-action.js.es6 index d6f52c13fdc..5de00031a57 100644 --- a/app/assets/javascripts/admin/controllers/admin-watched-words-action.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-watched-words-action.js.es6 @@ -1,16 +1,15 @@ import discourseComputed from "discourse-common/utils/decorators"; import { or } from "@ember/object/computed"; import { schedule } from "@ember/runloop"; -import { inject } from "@ember/controller"; -import Controller from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; import WatchedWord from "admin/models/watched-word"; import { ajax } from "discourse/lib/ajax"; import { fmt } from "discourse/lib/computed"; import showModal from "discourse/lib/show-modal"; export default Controller.extend({ + adminWatchedWords: controller(), actionNameKey: null, - adminWatchedWords: inject(), showWordsList: or( "adminWatchedWords.filtered", "adminWatchedWords.showWords" diff --git a/app/assets/javascripts/admin/controllers/admin-web-hooks-show.js.es6 b/app/assets/javascripts/admin/controllers/admin-web-hooks-show.js.es6 index 4ba34034f35..4332f52d9cc 100644 --- a/app/assets/javascripts/admin/controllers/admin-web-hooks-show.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-web-hooks-show.js.es6 @@ -1,14 +1,13 @@ import discourseComputed from "discourse-common/utils/decorators"; import { isEmpty } from "@ember/utils"; import { alias } from "@ember/object/computed"; -import { inject } from "@ember/controller"; -import Controller from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; import { popupAjaxError } from "discourse/lib/ajax-error"; import { extractDomainFromUrl } from "discourse/lib/utilities"; import EmberObject from "@ember/object"; export default Controller.extend({ - adminWebHooks: inject(), + adminWebHooks: controller(), eventTypes: alias("adminWebHooks.eventTypes"), defaultEventTypes: alias("adminWebHooks.defaultEventTypes"), contentTypes: alias("adminWebHooks.contentTypes"), diff --git a/app/assets/javascripts/admin/controllers/modals/admin-add-upload.js.es6 b/app/assets/javascripts/admin/controllers/modals/admin-add-upload.js.es6 index c7d9447d8d4..6fb28596182 100644 --- a/app/assets/javascripts/admin/controllers/modals/admin-add-upload.js.es6 +++ b/app/assets/javascripts/admin/controllers/modals/admin-add-upload.js.es6 @@ -1,7 +1,6 @@ import { isEmpty } from "@ember/utils"; import { and, not } from "@ember/object/computed"; -import { inject } from "@ember/controller"; -import Controller from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; import ModalFunctionality from "discourse/mixins/modal-functionality"; import { ajax } from "discourse/lib/ajax"; import discourseComputed, { observes } from "discourse-common/utils/decorators"; @@ -54,7 +53,7 @@ const SCSS_VARIABLE_NAMES = [ ]; export default Controller.extend(ModalFunctionality, { - adminCustomizeThemesShow: inject(), + adminCustomizeThemesShow: controller(), uploadUrl: "/admin/themes/upload_asset", diff --git a/app/assets/javascripts/admin/controllers/modals/admin-color-scheme-select-base.js.es6 b/app/assets/javascripts/admin/controllers/modals/admin-color-scheme-select-base.js.es6 index e0b7bfe7e6e..1ea601202d9 100644 --- a/app/assets/javascripts/admin/controllers/modals/admin-color-scheme-select-base.js.es6 +++ b/app/assets/javascripts/admin/controllers/modals/admin-color-scheme-select-base.js.es6 @@ -1,9 +1,8 @@ -import { inject } from "@ember/controller"; -import Controller from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; import ModalFunctionality from "discourse/mixins/modal-functionality"; export default Controller.extend(ModalFunctionality, { - adminCustomizeColors: inject(), + adminCustomizeColors: controller(), selectedBaseThemeId: null, diff --git a/app/assets/javascripts/admin/controllers/modals/admin-install-theme.js.es6 b/app/assets/javascripts/admin/controllers/modals/admin-install-theme.js.es6 index cfb61ccc8fd..7c0036539c5 100644 --- a/app/assets/javascripts/admin/controllers/modals/admin-install-theme.js.es6 +++ b/app/assets/javascripts/admin/controllers/modals/admin-install-theme.js.es6 @@ -1,6 +1,5 @@ import { equal, match, alias } from "@ember/object/computed"; -import { inject } from "@ember/controller"; -import Controller from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; import ModalFunctionality from "discourse/mixins/modal-functionality"; import { ajax } from "discourse/lib/ajax"; import { popupAjaxError } from "discourse/lib/ajax-error"; @@ -12,12 +11,13 @@ import { set } from "@ember/object"; const MIN_NAME_LENGTH = 4; export default Controller.extend(ModalFunctionality, { + adminCustomizeThemes: controller(), + themesController: controller("adminCustomizeThemes"), 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", @@ -27,7 +27,6 @@ export default Controller.extend(ModalFunctionality, { uploadUrl: null, urlPlaceholder: "https://github.com/discourse/sample_theme", advancedVisible: false, - themesController: inject("adminCustomizeThemes"), selectedType: alias("themesController.currentTab"), component: equal("selectedType", COMPONENTS), diff --git a/app/assets/javascripts/admin/controllers/modals/admin-start-backup.js.es6 b/app/assets/javascripts/admin/controllers/modals/admin-start-backup.js.es6 index b4cc2f188da..c2136e6cc66 100644 --- a/app/assets/javascripts/admin/controllers/modals/admin-start-backup.js.es6 +++ b/app/assets/javascripts/admin/controllers/modals/admin-start-backup.js.es6 @@ -1,9 +1,8 @@ -import { inject } from "@ember/controller"; -import Controller from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; import ModalFunctionality from "discourse/mixins/modal-functionality"; export default Controller.extend(ModalFunctionality, { - adminBackupsLogs: inject(), + adminBackupsLogs: controller(), actions: { startBackupWithUploads() { diff --git a/app/assets/javascripts/discourse/controllers/activation-edit.js.es6 b/app/assets/javascripts/discourse/controllers/activation-edit.js.es6 index 010878f7200..334f6582c5c 100644 --- a/app/assets/javascripts/discourse/controllers/activation-edit.js.es6 +++ b/app/assets/javascripts/discourse/controllers/activation-edit.js.es6 @@ -1,12 +1,11 @@ import discourseComputed from "discourse-common/utils/decorators"; -import { inject } from "@ember/controller"; -import Controller from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; import ModalFunctionality from "discourse/mixins/modal-functionality"; import { extractError } from "discourse/lib/ajax-error"; import { changeEmail } from "discourse/lib/user-activation"; export default Controller.extend(ModalFunctionality, { - login: inject(), + login: controller(), currentEmail: null, newEmail: null, diff --git a/app/assets/javascripts/discourse/controllers/badges/show.js.es6 b/app/assets/javascripts/discourse/controllers/badges/show.js.es6 index e9d70aa80fa..ae89c737ea7 100644 --- a/app/assets/javascripts/discourse/controllers/badges/show.js.es6 +++ b/app/assets/javascripts/discourse/controllers/badges/show.js.es6 @@ -1,15 +1,14 @@ -import { inject } from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; import EmberObject from "@ember/object"; -import Controller from "@ember/controller"; import Badge from "discourse/models/badge"; import UserBadge from "discourse/models/user-badge"; import discourseComputed, { observes } from "discourse-common/utils/decorators"; export default Controller.extend({ + application: controller(), queryParams: ["username"], noMoreBadges: false, userBadges: null, - application: inject(), hiddenSetTitle: true, @discourseComputed("userBadgesAll") diff --git a/app/assets/javascripts/discourse/controllers/bulk-notification-level.js.es6 b/app/assets/javascripts/discourse/controllers/bulk-notification-level.js.es6 index d9627ee47fc..7e0642c9fc7 100644 --- a/app/assets/javascripts/discourse/controllers/bulk-notification-level.js.es6 +++ b/app/assets/javascripts/discourse/controllers/bulk-notification-level.js.es6 @@ -1,12 +1,11 @@ import discourseComputed from "discourse-common/utils/decorators"; import { empty } from "@ember/object/computed"; -import { inject } from "@ember/controller"; -import Controller from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; import { topicLevels } from "discourse/lib/notification-levels"; // Support for changing the notification level of various topics export default Controller.extend({ - topicBulkActions: inject(), + topicBulkActions: controller(), notificationLevelId: null, @discourseComputed diff --git a/app/assets/javascripts/discourse/controllers/create-account.js.es6 b/app/assets/javascripts/discourse/controllers/create-account.js.es6 index 9e7c03d121b..62085e548ed 100644 --- a/app/assets/javascripts/discourse/controllers/create-account.js.es6 +++ b/app/assets/javascripts/discourse/controllers/create-account.js.es6 @@ -1,7 +1,6 @@ import { isEmpty } from "@ember/utils"; import { notEmpty, or, not } from "@ember/object/computed"; -import { inject } from "@ember/controller"; -import Controller from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; import { ajax } from "discourse/lib/ajax"; import ModalFunctionality from "discourse/mixins/modal-functionality"; import { setting } from "discourse/lib/computed"; @@ -26,7 +25,7 @@ export default Controller.extend( NameValidation, UserFieldsValidation, { - login: inject(), + login: controller(), complete: false, accountChallenge: 0, diff --git a/app/assets/javascripts/discourse/controllers/discovery.js.es6 b/app/assets/javascripts/discourse/controllers/discovery.js.es6 index fa374b43723..9d666eb271e 100644 --- a/app/assets/javascripts/discourse/controllers/discovery.js.es6 +++ b/app/assets/javascripts/discourse/controllers/discovery.js.es6 @@ -1,14 +1,13 @@ import { alias, not } from "@ember/object/computed"; -import { inject } from "@ember/controller"; -import Controller from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; import DiscourseURL from "discourse/lib/url"; import Category from "discourse/models/category"; import { observes } from "discourse-common/utils/decorators"; export default Controller.extend({ - discoveryTopics: inject("discovery/topics"), - navigationCategory: inject("navigation/category"), - application: inject(), + discoveryTopics: controller("discovery/topics"), + navigationCategory: controller("navigation/category"), + application: controller(), loading: false, diff --git a/app/assets/javascripts/discourse/controllers/discovery/categories.js.es6 b/app/assets/javascripts/discourse/controllers/discovery/categories.js.es6 index 69e59db2a96..c02dece344b 100644 --- a/app/assets/javascripts/discourse/controllers/discovery/categories.js.es6 +++ b/app/assets/javascripts/discourse/controllers/discovery/categories.js.es6 @@ -1,6 +1,6 @@ import discourseComputed from "discourse-common/utils/decorators"; import { reads } from "@ember/object/computed"; -import { inject } from "@ember/controller"; +import { inject as controller } from "@ember/controller"; import DiscoveryController from "discourse/controllers/discovery"; import { dasherize } from "@ember/string"; @@ -12,7 +12,7 @@ const subcategoryStyleComponentNames = { }; export default DiscoveryController.extend({ - discovery: inject(), + discovery: controller(), // this makes sure the composer isn't scoping to a specific category category: null, diff --git a/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 b/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 index 047960ba8a3..0ea6c599183 100644 --- a/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 +++ b/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 @@ -1,6 +1,6 @@ import discourseComputed from "discourse-common/utils/decorators"; import { alias, not, gt, empty, notEmpty, equal } from "@ember/object/computed"; -import { inject } from "@ember/controller"; +import { inject as controller } from "@ember/controller"; import DiscoveryController from "discourse/controllers/discovery"; import { queryParams } from "discourse/controllers/discovery-sortable"; import BulkTopicSelection from "discourse/mixins/bulk-topic-selection"; @@ -11,8 +11,8 @@ import TopicList from "discourse/models/topic-list"; import Topic from "discourse/models/topic"; const controllerOpts = { - discovery: inject(), - discoveryTopics: inject("discovery/topics"), + discovery: controller(), + discoveryTopics: controller("discovery/topics"), period: null, diff --git a/app/assets/javascripts/discourse/controllers/full-page-search.js.es6 b/app/assets/javascripts/discourse/controllers/full-page-search.js.es6 index a143203720e..5a92e4a4537 100644 --- a/app/assets/javascripts/discourse/controllers/full-page-search.js.es6 +++ b/app/assets/javascripts/discourse/controllers/full-page-search.js.es6 @@ -1,7 +1,6 @@ import { isEmpty } from "@ember/utils"; import { or } from "@ember/object/computed"; -import { inject } from "@ember/controller"; -import Controller from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; import { ajax } from "discourse/lib/ajax"; import { translateResults, @@ -26,8 +25,8 @@ const SortOrders = [ const PAGE_LIMIT = 10; export default Controller.extend({ - application: inject(), - composer: inject(), + application: controller(), + composer: controller(), bulkSelectEnabled: null, loading: false, diff --git a/app/assets/javascripts/discourse/controllers/group-activity-posts.js.es6 b/app/assets/javascripts/discourse/controllers/group-activity-posts.js.es6 index d73bf08d2fc..8a9604917f7 100644 --- a/app/assets/javascripts/discourse/controllers/group-activity-posts.js.es6 +++ b/app/assets/javascripts/discourse/controllers/group-activity-posts.js.es6 @@ -1,12 +1,11 @@ -import { inject } from "@ember/controller"; -import Controller from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; import { observes } from "discourse-common/utils/decorators"; import { fmt } from "discourse/lib/computed"; export default Controller.extend({ - group: inject(), - groupActivity: inject(), - application: inject(), + group: controller(), + groupActivity: controller(), + application: controller(), canLoadMore: true, loading: false, emptyText: fmt("type", "groups.empty.%@"), diff --git a/app/assets/javascripts/discourse/controllers/group-index.js.es6 b/app/assets/javascripts/discourse/controllers/group-index.js.es6 index 6916164dd65..b4168ba4c0d 100644 --- a/app/assets/javascripts/discourse/controllers/group-index.js.es6 +++ b/app/assets/javascripts/discourse/controllers/group-index.js.es6 @@ -1,11 +1,11 @@ -import Controller, { inject } from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; import { alias } from "@ember/object/computed"; import discourseComputed, { observes } from "discourse-common/utils/decorators"; import { popupAjaxError } from "discourse/lib/ajax-error"; import discourseDebounce from "discourse/lib/debounce"; export default Controller.extend({ - application: inject(), + application: controller(), queryParams: ["order", "desc", "filter"], diff --git a/app/assets/javascripts/discourse/controllers/group-manage-logs.js.es6 b/app/assets/javascripts/discourse/controllers/group-manage-logs.js.es6 index 41a12c2c98e..80947cb9a61 100644 --- a/app/assets/javascripts/discourse/controllers/group-manage-logs.js.es6 +++ b/app/assets/javascripts/discourse/controllers/group-manage-logs.js.es6 @@ -1,13 +1,12 @@ -import { inject } from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; import EmberObject from "@ember/object"; -import Controller from "@ember/controller"; import discourseComputed, { observes } from "discourse-common/utils/decorators"; export default Controller.extend({ - group: inject(), + group: controller(), + application: controller(), loading: false, offset: 0, - application: inject(), init() { this._super(...arguments); diff --git a/app/assets/javascripts/discourse/controllers/group-requests.js.es6 b/app/assets/javascripts/discourse/controllers/group-requests.js.es6 index c1664f0c32f..7212826c71e 100644 --- a/app/assets/javascripts/discourse/controllers/group-requests.js.es6 +++ b/app/assets/javascripts/discourse/controllers/group-requests.js.es6 @@ -1,11 +1,11 @@ -import Controller, { inject } from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; import discourseComputed, { observes } from "discourse-common/utils/decorators"; import { ajax } from "discourse/lib/ajax"; import { popupAjaxError } from "discourse/lib/ajax-error"; import discourseDebounce from "discourse/lib/debounce"; export default Controller.extend({ - application: inject(), + application: controller(), queryParams: ["order", "desc", "filter"], diff --git a/app/assets/javascripts/discourse/controllers/group.js.es6 b/app/assets/javascripts/discourse/controllers/group.js.es6 index 71354f58d3e..b66561f39ce 100644 --- a/app/assets/javascripts/discourse/controllers/group.js.es6 +++ b/app/assets/javascripts/discourse/controllers/group.js.es6 @@ -1,6 +1,5 @@ import EmberObject from "@ember/object"; -import { inject } from "@ember/controller"; -import Controller from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; import discourseComputed from "discourse-common/utils/decorators"; import { inject as service } from "@ember/service"; import { readOnly } from "@ember/object/computed"; @@ -15,7 +14,7 @@ const Tab = EmberObject.extend({ }); export default Controller.extend({ - application: inject(), + application: controller(), counts: null, showing: "members", destroying: null, diff --git a/app/assets/javascripts/discourse/controllers/groups-index.js.es6 b/app/assets/javascripts/discourse/controllers/groups-index.js.es6 index 00276d0215c..66743226779 100644 --- a/app/assets/javascripts/discourse/controllers/groups-index.js.es6 +++ b/app/assets/javascripts/discourse/controllers/groups-index.js.es6 @@ -1,10 +1,9 @@ -import { inject } from "@ember/controller"; -import Controller from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; import discourseDebounce from "discourse/lib/debounce"; import discourseComputed, { observes } from "discourse-common/utils/decorators"; export default Controller.extend({ - application: inject(), + application: controller(), queryParams: ["order", "asc", "filter", "type"], order: null, asc: null, diff --git a/app/assets/javascripts/discourse/controllers/login.js.es6 b/app/assets/javascripts/discourse/controllers/login.js.es6 index fe57a856ec5..9d4c56f56ef 100644 --- a/app/assets/javascripts/discourse/controllers/login.js.es6 +++ b/app/assets/javascripts/discourse/controllers/login.js.es6 @@ -4,8 +4,7 @@ import { alias, or, readOnly } from "@ember/object/computed"; import EmberObject from "@ember/object"; import { next } from "@ember/runloop"; import { scheduleOnce } from "@ember/runloop"; -import { inject } from "@ember/controller"; -import Controller from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; import { ajax } from "discourse/lib/ajax"; import ModalFunctionality from "discourse/mixins/modal-functionality"; import showModal from "discourse/lib/show-modal"; @@ -27,9 +26,9 @@ const AuthErrors = [ ]; export default Controller.extend(ModalFunctionality, { - createAccount: inject(), - forgotPassword: inject(), - application: inject(), + createAccount: controller(), + forgotPassword: controller(), + application: controller(), loggingIn: false, loggedIn: false, diff --git a/app/assets/javascripts/discourse/controllers/navigation/default.js.es6 b/app/assets/javascripts/discourse/controllers/navigation/default.js.es6 index 02dd26acde8..5dd5f167c76 100644 --- a/app/assets/javascripts/discourse/controllers/navigation/default.js.es6 +++ b/app/assets/javascripts/discourse/controllers/navigation/default.js.es6 @@ -1,11 +1,10 @@ import discourseComputed from "discourse-common/utils/decorators"; -import { inject } from "@ember/controller"; -import Controller from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; import FilterModeMixin from "discourse/mixins/filter-mode"; export default Controller.extend(FilterModeMixin, { - discovery: inject(), - discoveryTopics: inject("discovery/topics"), + discovery: controller(), + discoveryTopics: controller("discovery/topics"), @discourseComputed("discoveryTopics.model", "discoveryTopics.model.draft") draft: function() { diff --git a/app/assets/javascripts/discourse/controllers/static.js.es6 b/app/assets/javascripts/discourse/controllers/static.js.es6 index ad4f953105a..9f139b6d928 100644 --- a/app/assets/javascripts/discourse/controllers/static.js.es6 +++ b/app/assets/javascripts/discourse/controllers/static.js.es6 @@ -1,12 +1,11 @@ import discourseComputed from "discourse-common/utils/decorators"; import { equal } from "@ember/object/computed"; -import { inject } from "@ember/controller"; -import Controller from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; import { ajax } from "discourse/lib/ajax"; import { userPath } from "discourse/lib/url"; export default Controller.extend({ - application: inject(), + application: controller(), showLoginButton: equal("model.path", "login"), diff --git a/app/assets/javascripts/discourse/controllers/tag-groups-edit.js.es6 b/app/assets/javascripts/discourse/controllers/tag-groups-edit.js.es6 index 067a2f615b8..5c6a7aefb7c 100644 --- a/app/assets/javascripts/discourse/controllers/tag-groups-edit.js.es6 +++ b/app/assets/javascripts/discourse/controllers/tag-groups-edit.js.es6 @@ -1,8 +1,7 @@ -import { inject } from "@ember/controller"; -import Controller from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; export default Controller.extend({ - tagGroups: inject(), + tagGroups: controller(), actions: { onDestroy() { diff --git a/app/assets/javascripts/discourse/controllers/tag-groups-new.js.es6 b/app/assets/javascripts/discourse/controllers/tag-groups-new.js.es6 index d2d37058665..f4825bdd350 100644 --- a/app/assets/javascripts/discourse/controllers/tag-groups-new.js.es6 +++ b/app/assets/javascripts/discourse/controllers/tag-groups-new.js.es6 @@ -1,7 +1,7 @@ -import Controller, { inject } from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; export default Controller.extend({ - tagGroups: inject(), + tagGroups: controller(), actions: { onSave() { diff --git a/app/assets/javascripts/discourse/controllers/tags-show.js.es6 b/app/assets/javascripts/discourse/controllers/tags-show.js.es6 index c4d79e8643a..a44cf850c87 100644 --- a/app/assets/javascripts/discourse/controllers/tags-show.js.es6 +++ b/app/assets/javascripts/discourse/controllers/tags-show.js.es6 @@ -1,6 +1,5 @@ import { alias } from "@ember/object/computed"; -import { inject } from "@ember/controller"; -import Controller from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; import discourseComputed, { observes } from "discourse-common/utils/decorators"; import BulkTopicSelection from "discourse/mixins/bulk-topic-selection"; import NavItem from "discourse/models/nav-item"; @@ -8,7 +7,7 @@ import FilterModeMixin from "discourse/mixins/filter-mode"; import { queryParams } from "discourse/controllers/discovery-sortable"; export default Controller.extend(BulkTopicSelection, FilterModeMixin, { - application: inject(), + application: controller(), tag: null, additionalTags: null, diff --git a/app/assets/javascripts/discourse/controllers/topic.js.es6 b/app/assets/javascripts/discourse/controllers/topic.js.es6 index ec53fe427de..12c4ceaaea1 100644 --- a/app/assets/javascripts/discourse/controllers/topic.js.es6 +++ b/app/assets/javascripts/discourse/controllers/topic.js.es6 @@ -3,8 +3,7 @@ import { or, and, not, alias } from "@ember/object/computed"; import EmberObject from "@ember/object"; import { next } from "@ember/runloop"; import { scheduleOnce } from "@ember/runloop"; -import { inject } from "@ember/controller"; -import Controller from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; import { bufferedProperty } from "discourse/mixins/buffered-content"; import Composer from "discourse/models/composer"; import DiscourseURL from "discourse/lib/url"; @@ -39,8 +38,8 @@ export function registerCustomPostMessageCallback(type, callback) { } export default Controller.extend(bufferedProperty("model"), { - composer: inject(), - application: inject(), + composer: controller(), + application: controller(), multiSelect: false, selectedPostIds: null, editingTopic: false, @@ -696,10 +695,10 @@ export default Controller.extend(bufferedProperty("model"), { jumpToPostPrompt() { const topic = this.model; - const controller = showModal("jump-to-post", { + const modal = showModal("jump-to-post", { modalClass: "jump-to-post-modal" }); - controller.setProperties({ + modal.setProperties({ topic, postNumber: null, jumpToIndex: index => this.send("jumpToIndex", index), @@ -840,8 +839,8 @@ export default Controller.extend(bufferedProperty("model"), { addNotice(post) { return new Promise(function(resolve, reject) { - const controller = showModal("add-post-notice"); - controller.setProperties({ post, resolve, reject }); + const modal = showModal("add-post-notice"); + modal.setProperties({ post, resolve, reject }); }); }, diff --git a/app/assets/javascripts/discourse/controllers/user-activity.js.es6 b/app/assets/javascripts/discourse/controllers/user-activity.js.es6 index 473f24c7530..12333fcf074 100644 --- a/app/assets/javascripts/discourse/controllers/user-activity.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user-activity.js.es6 @@ -1,14 +1,13 @@ import { alias } from "@ember/object/computed"; import { inject as service } from "@ember/service"; -import { inject } from "@ember/controller"; -import Controller from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; import { exportUserArchive } from "discourse/lib/export-csv"; import { observes } from "discourse-common/utils/decorators"; export default Controller.extend({ - application: inject(), + application: controller(), + user: controller(), router: service(), - user: inject(), userActionType: null, canDownloadPosts: alias("user.viewingSelf"), diff --git a/app/assets/javascripts/discourse/controllers/user-badges.js.es6 b/app/assets/javascripts/discourse/controllers/user-badges.js.es6 index 01df9566afe..d5bfab5dc8a 100644 --- a/app/assets/javascripts/discourse/controllers/user-badges.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user-badges.js.es6 @@ -1,8 +1,8 @@ import { alias, sort } from "@ember/object/computed"; -import { inject } from "@ember/controller"; -import Controller from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; + export default Controller.extend({ - user: inject(), + user: controller(), username: alias("user.model.username_lower"), sortedBadges: sort("model", "badgeSortOrder"), diff --git a/app/assets/javascripts/discourse/controllers/user-card.js.es6 b/app/assets/javascripts/discourse/controllers/user-card.js.es6 index 862fc92e73f..a3584e9f100 100644 --- a/app/assets/javascripts/discourse/controllers/user-card.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user-card.js.es6 @@ -1,10 +1,9 @@ import { inject as service } from "@ember/service"; -import { inject } from "@ember/controller"; -import Controller from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; import DiscourseURL, { userPath, groupPath } from "discourse/lib/url"; export default Controller.extend({ - topic: inject(), + topic: controller(), router: service(), actions: { diff --git a/app/assets/javascripts/discourse/controllers/user-notifications.js.es6 b/app/assets/javascripts/discourse/controllers/user-notifications.js.es6 index 23efcfc2140..b6cceef185e 100644 --- a/app/assets/javascripts/discourse/controllers/user-notifications.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user-notifications.js.es6 @@ -1,12 +1,11 @@ -import { inject } from "@ember/controller"; -import Controller from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; import { ajax } from "discourse/lib/ajax"; import discourseComputed, { observes } from "discourse-common/utils/decorators"; import { readOnly } from "@ember/object/computed"; import { inject as service } from "@ember/service"; export default Controller.extend({ - application: inject(), + application: controller(), router: service(), currentPath: readOnly("router._router.currentPath"), diff --git a/app/assets/javascripts/discourse/controllers/user-posts.js.es6 b/app/assets/javascripts/discourse/controllers/user-posts.js.es6 index e5de7e99955..0e2852d60d3 100644 --- a/app/assets/javascripts/discourse/controllers/user-posts.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user-posts.js.es6 @@ -1,9 +1,8 @@ -import { inject } from "@ember/controller"; -import Controller from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; import { observes } from "discourse-common/utils/decorators"; export default Controller.extend({ - application: inject(), + application: controller(), @observes("model.canLoadMore") _showFooter: function() { diff --git a/app/assets/javascripts/discourse/controllers/user-private-messages.js.es6 b/app/assets/javascripts/discourse/controllers/user-private-messages.js.es6 index 8a216985164..79cdc7822a8 100644 --- a/app/assets/javascripts/discourse/controllers/user-private-messages.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user-private-messages.js.es6 @@ -1,14 +1,13 @@ import discourseComputed from "discourse-common/utils/decorators"; import { alias, equal, and } from "@ember/object/computed"; import { inject as service } from "@ember/service"; -import { inject } from "@ember/controller"; -import Controller from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; import Topic from "discourse/models/topic"; export default Controller.extend({ + userTopicsList: controller("user-topics-list"), + user: controller(), router: service(), - userTopicsList: inject("user-topics-list"), - user: inject(), pmView: false, viewingSelf: alias("user.viewingSelf"), diff --git a/app/assets/javascripts/discourse/controllers/user-topics-list.js.es6 b/app/assets/javascripts/discourse/controllers/user-topics-list.js.es6 index f541ac01ca1..91483bafc2d 100644 --- a/app/assets/javascripts/discourse/controllers/user-topics-list.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user-topics-list.js.es6 @@ -1,10 +1,9 @@ import discourseComputed, { observes } from "discourse-common/utils/decorators"; -import { inject } from "@ember/controller"; -import Controller from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; // Lists of topics on a user's page. export default Controller.extend({ - application: inject(), + application: controller(), hideCategory: false, showPosters: false, diff --git a/app/assets/javascripts/discourse/controllers/users.js.es6 b/app/assets/javascripts/discourse/controllers/users.js.es6 index 820e50b0af5..89c20efa69b 100644 --- a/app/assets/javascripts/discourse/controllers/users.js.es6 +++ b/app/assets/javascripts/discourse/controllers/users.js.es6 @@ -1,11 +1,10 @@ import { equal } from "@ember/object/computed"; -import { inject } from "@ember/controller"; -import Controller from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; import discourseDebounce from "discourse/lib/debounce"; import { observes } from "discourse-common/utils/decorators"; export default Controller.extend({ - application: inject(), + application: controller(), queryParams: ["period", "order", "asc", "name", "group", "exclude_usernames"], period: "weekly", order: "likes_received",