DEV: Use aliased `inject` imports (#9086)

This is a common Ember idiom for easier differentiation between controller and service imports.
This commit is contained in:
Jarek Radosz 2020-03-06 17:41:41 +01:00 committed by GitHub
parent 03d5a80aef
commit ef6b7bd776
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 100 additions and 132 deletions

View File

@ -1,12 +1,11 @@
import { alias, equal } from "@ember/object/computed"; import { alias, equal } from "@ember/object/computed";
import { inject } from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
import Controller from "@ember/controller";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
import discourseComputed from "discourse-common/utils/decorators"; import discourseComputed from "discourse-common/utils/decorators";
import { setting, i18n } from "discourse/lib/computed"; import { setting, i18n } from "discourse/lib/computed";
export default Controller.extend({ export default Controller.extend({
adminBackups: inject(), adminBackups: controller(),
status: alias("adminBackups.model"), status: alias("adminBackups.model"),
uploadLabel: i18n("admin.backups.upload.label"), uploadLabel: i18n("admin.backups.upload.label"),
backupLocation: setting("backup_location"), backupLocation: setting("backup_location"),

View File

@ -1,8 +1,8 @@
import { alias } from "@ember/object/computed"; import { alias } from "@ember/object/computed";
import { inject } from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
import Controller from "@ember/controller";
export default Controller.extend({ export default Controller.extend({
adminBackups: inject(), adminBackups: controller(),
status: alias("adminBackups.model"), status: alias("adminBackups.model"),
init() { init() {

View File

@ -1,13 +1,13 @@
import discourseComputed, { observes } from "discourse-common/utils/decorators"; import discourseComputed, { observes } from "discourse-common/utils/decorators";
import { reads } from "@ember/object/computed"; 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 { popupAjaxError } from "discourse/lib/ajax-error";
import { bufferedProperty } from "discourse/mixins/buffered-content"; import { bufferedProperty } from "discourse/mixins/buffered-content";
import { propertyNotEqual } from "discourse/lib/computed"; import { propertyNotEqual } from "discourse/lib/computed";
import { run } from "@ember/runloop"; import { run } from "@ember/runloop";
export default Controller.extend(bufferedProperty("model"), { export default Controller.extend(bufferedProperty("model"), {
adminBadges: inject(), adminBadges: controller(),
saving: false, saving: false,
savingStatus: "", savingStatus: "",
badgeTypes: reads("adminBadges.badgeTypes"), badgeTypes: reads("adminBadges.badgeTypes"),

View File

@ -1,10 +1,9 @@
import discourseComputed from "discourse-common/utils/decorators"; import discourseComputed from "discourse-common/utils/decorators";
import { inject } from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
import Controller from "@ember/controller";
export default Controller.extend({ export default Controller.extend({
adminSiteSettings: controller(),
categoryNameKey: null, categoryNameKey: null,
adminSiteSettings: inject(),
@discourseComputed("adminSiteSettings.visibleSiteSettings", "categoryNameKey") @discourseComputed("adminSiteSettings.visibleSiteSettings", "categoryNameKey")
category(categories, nameKey) { category(categories, nameKey) {

View File

@ -1,13 +1,12 @@
import discourseComputed from "discourse-common/utils/decorators"; import discourseComputed from "discourse-common/utils/decorators";
import { alias, sort } from "@ember/object/computed"; import { alias, sort } from "@ember/object/computed";
import { next } from "@ember/runloop"; import { next } from "@ember/runloop";
import { inject } from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
import Controller from "@ember/controller";
import GrantBadgeController from "discourse/mixins/grant-badge-controller"; import GrantBadgeController from "discourse/mixins/grant-badge-controller";
import { popupAjaxError } from "discourse/lib/ajax-error"; import { popupAjaxError } from "discourse/lib/ajax-error";
export default Controller.extend(GrantBadgeController, { export default Controller.extend(GrantBadgeController, {
adminUser: inject(), adminUser: controller(),
user: alias("adminUser.model"), user: alias("adminUser.model"),
userBadges: alias("model"), userBadges: alias("model"),
allBadges: alias("badges"), allBadges: alias("badges"),

View File

@ -1,16 +1,15 @@
import discourseComputed from "discourse-common/utils/decorators"; import discourseComputed from "discourse-common/utils/decorators";
import { or } from "@ember/object/computed"; import { or } from "@ember/object/computed";
import { schedule } from "@ember/runloop"; import { schedule } from "@ember/runloop";
import { inject } from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
import Controller from "@ember/controller";
import WatchedWord from "admin/models/watched-word"; import WatchedWord from "admin/models/watched-word";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
import { fmt } from "discourse/lib/computed"; import { fmt } from "discourse/lib/computed";
import showModal from "discourse/lib/show-modal"; import showModal from "discourse/lib/show-modal";
export default Controller.extend({ export default Controller.extend({
adminWatchedWords: controller(),
actionNameKey: null, actionNameKey: null,
adminWatchedWords: inject(),
showWordsList: or( showWordsList: or(
"adminWatchedWords.filtered", "adminWatchedWords.filtered",
"adminWatchedWords.showWords" "adminWatchedWords.showWords"

View File

@ -1,14 +1,13 @@
import discourseComputed from "discourse-common/utils/decorators"; import discourseComputed from "discourse-common/utils/decorators";
import { isEmpty } from "@ember/utils"; import { isEmpty } from "@ember/utils";
import { alias } from "@ember/object/computed"; import { alias } from "@ember/object/computed";
import { inject } from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
import Controller from "@ember/controller";
import { popupAjaxError } from "discourse/lib/ajax-error"; import { popupAjaxError } from "discourse/lib/ajax-error";
import { extractDomainFromUrl } from "discourse/lib/utilities"; import { extractDomainFromUrl } from "discourse/lib/utilities";
import EmberObject from "@ember/object"; import EmberObject from "@ember/object";
export default Controller.extend({ export default Controller.extend({
adminWebHooks: inject(), adminWebHooks: controller(),
eventTypes: alias("adminWebHooks.eventTypes"), eventTypes: alias("adminWebHooks.eventTypes"),
defaultEventTypes: alias("adminWebHooks.defaultEventTypes"), defaultEventTypes: alias("adminWebHooks.defaultEventTypes"),
contentTypes: alias("adminWebHooks.contentTypes"), contentTypes: alias("adminWebHooks.contentTypes"),

View File

@ -1,7 +1,6 @@
import { isEmpty } from "@ember/utils"; import { isEmpty } from "@ember/utils";
import { and, not } from "@ember/object/computed"; import { and, not } from "@ember/object/computed";
import { inject } from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
import Controller from "@ember/controller";
import ModalFunctionality from "discourse/mixins/modal-functionality"; import ModalFunctionality from "discourse/mixins/modal-functionality";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
import discourseComputed, { observes } from "discourse-common/utils/decorators"; import discourseComputed, { observes } from "discourse-common/utils/decorators";
@ -54,7 +53,7 @@ const SCSS_VARIABLE_NAMES = [
]; ];
export default Controller.extend(ModalFunctionality, { export default Controller.extend(ModalFunctionality, {
adminCustomizeThemesShow: inject(), adminCustomizeThemesShow: controller(),
uploadUrl: "/admin/themes/upload_asset", uploadUrl: "/admin/themes/upload_asset",

View File

@ -1,9 +1,8 @@
import { inject } from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
import Controller from "@ember/controller";
import ModalFunctionality from "discourse/mixins/modal-functionality"; import ModalFunctionality from "discourse/mixins/modal-functionality";
export default Controller.extend(ModalFunctionality, { export default Controller.extend(ModalFunctionality, {
adminCustomizeColors: inject(), adminCustomizeColors: controller(),
selectedBaseThemeId: null, selectedBaseThemeId: null,

View File

@ -1,6 +1,5 @@
import { equal, match, alias } from "@ember/object/computed"; import { equal, match, alias } from "@ember/object/computed";
import { inject } from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
import Controller from "@ember/controller";
import ModalFunctionality from "discourse/mixins/modal-functionality"; import ModalFunctionality from "discourse/mixins/modal-functionality";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error"; import { popupAjaxError } from "discourse/lib/ajax-error";
@ -12,12 +11,13 @@ import { set } from "@ember/object";
const MIN_NAME_LENGTH = 4; const MIN_NAME_LENGTH = 4;
export default Controller.extend(ModalFunctionality, { export default Controller.extend(ModalFunctionality, {
adminCustomizeThemes: controller(),
themesController: controller("adminCustomizeThemes"),
popular: equal("selection", "popular"), popular: equal("selection", "popular"),
local: equal("selection", "local"), local: equal("selection", "local"),
remote: equal("selection", "remote"), remote: equal("selection", "remote"),
create: equal("selection", "create"), create: equal("selection", "create"),
selection: "popular", selection: "popular",
adminCustomizeThemes: inject(),
loading: false, loading: false,
keyGenUrl: "/admin/themes/generate_key_pair", keyGenUrl: "/admin/themes/generate_key_pair",
importUrl: "/admin/themes/import", importUrl: "/admin/themes/import",
@ -27,7 +27,6 @@ export default Controller.extend(ModalFunctionality, {
uploadUrl: null, uploadUrl: null,
urlPlaceholder: "https://github.com/discourse/sample_theme", urlPlaceholder: "https://github.com/discourse/sample_theme",
advancedVisible: false, advancedVisible: false,
themesController: inject("adminCustomizeThemes"),
selectedType: alias("themesController.currentTab"), selectedType: alias("themesController.currentTab"),
component: equal("selectedType", COMPONENTS), component: equal("selectedType", COMPONENTS),

View File

@ -1,9 +1,8 @@
import { inject } from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
import Controller from "@ember/controller";
import ModalFunctionality from "discourse/mixins/modal-functionality"; import ModalFunctionality from "discourse/mixins/modal-functionality";
export default Controller.extend(ModalFunctionality, { export default Controller.extend(ModalFunctionality, {
adminBackupsLogs: inject(), adminBackupsLogs: controller(),
actions: { actions: {
startBackupWithUploads() { startBackupWithUploads() {

View File

@ -1,12 +1,11 @@
import discourseComputed from "discourse-common/utils/decorators"; import discourseComputed from "discourse-common/utils/decorators";
import { inject } from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
import Controller from "@ember/controller";
import ModalFunctionality from "discourse/mixins/modal-functionality"; import ModalFunctionality from "discourse/mixins/modal-functionality";
import { extractError } from "discourse/lib/ajax-error"; import { extractError } from "discourse/lib/ajax-error";
import { changeEmail } from "discourse/lib/user-activation"; import { changeEmail } from "discourse/lib/user-activation";
export default Controller.extend(ModalFunctionality, { export default Controller.extend(ModalFunctionality, {
login: inject(), login: controller(),
currentEmail: null, currentEmail: null,
newEmail: null, newEmail: null,

View File

@ -1,15 +1,14 @@
import { inject } from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
import EmberObject from "@ember/object"; import EmberObject from "@ember/object";
import Controller from "@ember/controller";
import Badge from "discourse/models/badge"; import Badge from "discourse/models/badge";
import UserBadge from "discourse/models/user-badge"; import UserBadge from "discourse/models/user-badge";
import discourseComputed, { observes } from "discourse-common/utils/decorators"; import discourseComputed, { observes } from "discourse-common/utils/decorators";
export default Controller.extend({ export default Controller.extend({
application: controller(),
queryParams: ["username"], queryParams: ["username"],
noMoreBadges: false, noMoreBadges: false,
userBadges: null, userBadges: null,
application: inject(),
hiddenSetTitle: true, hiddenSetTitle: true,
@discourseComputed("userBadgesAll") @discourseComputed("userBadgesAll")

View File

@ -1,12 +1,11 @@
import discourseComputed from "discourse-common/utils/decorators"; import discourseComputed from "discourse-common/utils/decorators";
import { empty } from "@ember/object/computed"; import { empty } from "@ember/object/computed";
import { inject } from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
import Controller from "@ember/controller";
import { topicLevels } from "discourse/lib/notification-levels"; import { topicLevels } from "discourse/lib/notification-levels";
// Support for changing the notification level of various topics // Support for changing the notification level of various topics
export default Controller.extend({ export default Controller.extend({
topicBulkActions: inject(), topicBulkActions: controller(),
notificationLevelId: null, notificationLevelId: null,
@discourseComputed @discourseComputed

View File

@ -1,7 +1,6 @@
import { isEmpty } from "@ember/utils"; import { isEmpty } from "@ember/utils";
import { notEmpty, or, not } from "@ember/object/computed"; import { notEmpty, or, not } from "@ember/object/computed";
import { inject } from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
import Controller from "@ember/controller";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
import ModalFunctionality from "discourse/mixins/modal-functionality"; import ModalFunctionality from "discourse/mixins/modal-functionality";
import { setting } from "discourse/lib/computed"; import { setting } from "discourse/lib/computed";
@ -26,7 +25,7 @@ export default Controller.extend(
NameValidation, NameValidation,
UserFieldsValidation, UserFieldsValidation,
{ {
login: inject(), login: controller(),
complete: false, complete: false,
accountChallenge: 0, accountChallenge: 0,

View File

@ -1,14 +1,13 @@
import { alias, not } from "@ember/object/computed"; import { alias, not } from "@ember/object/computed";
import { inject } from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
import Controller from "@ember/controller";
import DiscourseURL from "discourse/lib/url"; import DiscourseURL from "discourse/lib/url";
import Category from "discourse/models/category"; import Category from "discourse/models/category";
import { observes } from "discourse-common/utils/decorators"; import { observes } from "discourse-common/utils/decorators";
export default Controller.extend({ export default Controller.extend({
discoveryTopics: inject("discovery/topics"), discoveryTopics: controller("discovery/topics"),
navigationCategory: inject("navigation/category"), navigationCategory: controller("navigation/category"),
application: inject(), application: controller(),
loading: false, loading: false,

View File

@ -1,6 +1,6 @@
import discourseComputed from "discourse-common/utils/decorators"; import discourseComputed from "discourse-common/utils/decorators";
import { reads } from "@ember/object/computed"; 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 DiscoveryController from "discourse/controllers/discovery";
import { dasherize } from "@ember/string"; import { dasherize } from "@ember/string";
@ -12,7 +12,7 @@ const subcategoryStyleComponentNames = {
}; };
export default DiscoveryController.extend({ export default DiscoveryController.extend({
discovery: inject(), discovery: controller(),
// this makes sure the composer isn't scoping to a specific category // this makes sure the composer isn't scoping to a specific category
category: null, category: null,

View File

@ -1,6 +1,6 @@
import discourseComputed from "discourse-common/utils/decorators"; import discourseComputed from "discourse-common/utils/decorators";
import { alias, not, gt, empty, notEmpty, equal } from "@ember/object/computed"; 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 DiscoveryController from "discourse/controllers/discovery";
import { queryParams } from "discourse/controllers/discovery-sortable"; import { queryParams } from "discourse/controllers/discovery-sortable";
import BulkTopicSelection from "discourse/mixins/bulk-topic-selection"; 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"; import Topic from "discourse/models/topic";
const controllerOpts = { const controllerOpts = {
discovery: inject(), discovery: controller(),
discoveryTopics: inject("discovery/topics"), discoveryTopics: controller("discovery/topics"),
period: null, period: null,

View File

@ -1,7 +1,6 @@
import { isEmpty } from "@ember/utils"; import { isEmpty } from "@ember/utils";
import { or } from "@ember/object/computed"; import { or } from "@ember/object/computed";
import { inject } from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
import Controller from "@ember/controller";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
import { import {
translateResults, translateResults,
@ -26,8 +25,8 @@ const SortOrders = [
const PAGE_LIMIT = 10; const PAGE_LIMIT = 10;
export default Controller.extend({ export default Controller.extend({
application: inject(), application: controller(),
composer: inject(), composer: controller(),
bulkSelectEnabled: null, bulkSelectEnabled: null,
loading: false, loading: false,

View File

@ -1,12 +1,11 @@
import { inject } from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
import Controller from "@ember/controller";
import { observes } from "discourse-common/utils/decorators"; import { observes } from "discourse-common/utils/decorators";
import { fmt } from "discourse/lib/computed"; import { fmt } from "discourse/lib/computed";
export default Controller.extend({ export default Controller.extend({
group: inject(), group: controller(),
groupActivity: inject(), groupActivity: controller(),
application: inject(), application: controller(),
canLoadMore: true, canLoadMore: true,
loading: false, loading: false,
emptyText: fmt("type", "groups.empty.%@"), emptyText: fmt("type", "groups.empty.%@"),

View File

@ -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 { alias } from "@ember/object/computed";
import discourseComputed, { observes } from "discourse-common/utils/decorators"; import discourseComputed, { observes } from "discourse-common/utils/decorators";
import { popupAjaxError } from "discourse/lib/ajax-error"; import { popupAjaxError } from "discourse/lib/ajax-error";
import discourseDebounce from "discourse/lib/debounce"; import discourseDebounce from "discourse/lib/debounce";
export default Controller.extend({ export default Controller.extend({
application: inject(), application: controller(),
queryParams: ["order", "desc", "filter"], queryParams: ["order", "desc", "filter"],

View File

@ -1,13 +1,12 @@
import { inject } from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
import EmberObject from "@ember/object"; import EmberObject from "@ember/object";
import Controller from "@ember/controller";
import discourseComputed, { observes } from "discourse-common/utils/decorators"; import discourseComputed, { observes } from "discourse-common/utils/decorators";
export default Controller.extend({ export default Controller.extend({
group: inject(), group: controller(),
application: controller(),
loading: false, loading: false,
offset: 0, offset: 0,
application: inject(),
init() { init() {
this._super(...arguments); this._super(...arguments);

View File

@ -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 discourseComputed, { observes } from "discourse-common/utils/decorators";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error"; import { popupAjaxError } from "discourse/lib/ajax-error";
import discourseDebounce from "discourse/lib/debounce"; import discourseDebounce from "discourse/lib/debounce";
export default Controller.extend({ export default Controller.extend({
application: inject(), application: controller(),
queryParams: ["order", "desc", "filter"], queryParams: ["order", "desc", "filter"],

View File

@ -1,6 +1,5 @@
import EmberObject from "@ember/object"; import EmberObject from "@ember/object";
import { inject } from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
import Controller from "@ember/controller";
import discourseComputed from "discourse-common/utils/decorators"; import discourseComputed from "discourse-common/utils/decorators";
import { inject as service } from "@ember/service"; import { inject as service } from "@ember/service";
import { readOnly } from "@ember/object/computed"; import { readOnly } from "@ember/object/computed";
@ -15,7 +14,7 @@ const Tab = EmberObject.extend({
}); });
export default Controller.extend({ export default Controller.extend({
application: inject(), application: controller(),
counts: null, counts: null,
showing: "members", showing: "members",
destroying: null, destroying: null,

View File

@ -1,10 +1,9 @@
import { inject } from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
import Controller from "@ember/controller";
import discourseDebounce from "discourse/lib/debounce"; import discourseDebounce from "discourse/lib/debounce";
import discourseComputed, { observes } from "discourse-common/utils/decorators"; import discourseComputed, { observes } from "discourse-common/utils/decorators";
export default Controller.extend({ export default Controller.extend({
application: inject(), application: controller(),
queryParams: ["order", "asc", "filter", "type"], queryParams: ["order", "asc", "filter", "type"],
order: null, order: null,
asc: null, asc: null,

View File

@ -4,8 +4,7 @@ import { alias, or, readOnly } from "@ember/object/computed";
import EmberObject from "@ember/object"; import EmberObject from "@ember/object";
import { next } from "@ember/runloop"; import { next } from "@ember/runloop";
import { scheduleOnce } from "@ember/runloop"; import { scheduleOnce } from "@ember/runloop";
import { inject } from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
import Controller from "@ember/controller";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
import ModalFunctionality from "discourse/mixins/modal-functionality"; import ModalFunctionality from "discourse/mixins/modal-functionality";
import showModal from "discourse/lib/show-modal"; import showModal from "discourse/lib/show-modal";
@ -27,9 +26,9 @@ const AuthErrors = [
]; ];
export default Controller.extend(ModalFunctionality, { export default Controller.extend(ModalFunctionality, {
createAccount: inject(), createAccount: controller(),
forgotPassword: inject(), forgotPassword: controller(),
application: inject(), application: controller(),
loggingIn: false, loggingIn: false,
loggedIn: false, loggedIn: false,

View File

@ -1,11 +1,10 @@
import discourseComputed from "discourse-common/utils/decorators"; import discourseComputed from "discourse-common/utils/decorators";
import { inject } from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
import Controller from "@ember/controller";
import FilterModeMixin from "discourse/mixins/filter-mode"; import FilterModeMixin from "discourse/mixins/filter-mode";
export default Controller.extend(FilterModeMixin, { export default Controller.extend(FilterModeMixin, {
discovery: inject(), discovery: controller(),
discoveryTopics: inject("discovery/topics"), discoveryTopics: controller("discovery/topics"),
@discourseComputed("discoveryTopics.model", "discoveryTopics.model.draft") @discourseComputed("discoveryTopics.model", "discoveryTopics.model.draft")
draft: function() { draft: function() {

View File

@ -1,12 +1,11 @@
import discourseComputed from "discourse-common/utils/decorators"; import discourseComputed from "discourse-common/utils/decorators";
import { equal } from "@ember/object/computed"; import { equal } from "@ember/object/computed";
import { inject } from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
import Controller from "@ember/controller";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
import { userPath } from "discourse/lib/url"; import { userPath } from "discourse/lib/url";
export default Controller.extend({ export default Controller.extend({
application: inject(), application: controller(),
showLoginButton: equal("model.path", "login"), showLoginButton: equal("model.path", "login"),

View File

@ -1,8 +1,7 @@
import { inject } from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
import Controller from "@ember/controller";
export default Controller.extend({ export default Controller.extend({
tagGroups: inject(), tagGroups: controller(),
actions: { actions: {
onDestroy() { onDestroy() {

View File

@ -1,7 +1,7 @@
import Controller, { inject } from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
export default Controller.extend({ export default Controller.extend({
tagGroups: inject(), tagGroups: controller(),
actions: { actions: {
onSave() { onSave() {

View File

@ -1,6 +1,5 @@
import { alias } from "@ember/object/computed"; import { alias } from "@ember/object/computed";
import { inject } from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
import Controller from "@ember/controller";
import discourseComputed, { observes } from "discourse-common/utils/decorators"; import discourseComputed, { observes } from "discourse-common/utils/decorators";
import BulkTopicSelection from "discourse/mixins/bulk-topic-selection"; import BulkTopicSelection from "discourse/mixins/bulk-topic-selection";
import NavItem from "discourse/models/nav-item"; 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"; import { queryParams } from "discourse/controllers/discovery-sortable";
export default Controller.extend(BulkTopicSelection, FilterModeMixin, { export default Controller.extend(BulkTopicSelection, FilterModeMixin, {
application: inject(), application: controller(),
tag: null, tag: null,
additionalTags: null, additionalTags: null,

View File

@ -3,8 +3,7 @@ import { or, and, not, alias } from "@ember/object/computed";
import EmberObject from "@ember/object"; import EmberObject from "@ember/object";
import { next } from "@ember/runloop"; import { next } from "@ember/runloop";
import { scheduleOnce } from "@ember/runloop"; import { scheduleOnce } from "@ember/runloop";
import { inject } from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
import Controller from "@ember/controller";
import { bufferedProperty } from "discourse/mixins/buffered-content"; import { bufferedProperty } from "discourse/mixins/buffered-content";
import Composer from "discourse/models/composer"; import Composer from "discourse/models/composer";
import DiscourseURL from "discourse/lib/url"; import DiscourseURL from "discourse/lib/url";
@ -39,8 +38,8 @@ export function registerCustomPostMessageCallback(type, callback) {
} }
export default Controller.extend(bufferedProperty("model"), { export default Controller.extend(bufferedProperty("model"), {
composer: inject(), composer: controller(),
application: inject(), application: controller(),
multiSelect: false, multiSelect: false,
selectedPostIds: null, selectedPostIds: null,
editingTopic: false, editingTopic: false,
@ -696,10 +695,10 @@ export default Controller.extend(bufferedProperty("model"), {
jumpToPostPrompt() { jumpToPostPrompt() {
const topic = this.model; const topic = this.model;
const controller = showModal("jump-to-post", { const modal = showModal("jump-to-post", {
modalClass: "jump-to-post-modal" modalClass: "jump-to-post-modal"
}); });
controller.setProperties({ modal.setProperties({
topic, topic,
postNumber: null, postNumber: null,
jumpToIndex: index => this.send("jumpToIndex", index), jumpToIndex: index => this.send("jumpToIndex", index),
@ -840,8 +839,8 @@ export default Controller.extend(bufferedProperty("model"), {
addNotice(post) { addNotice(post) {
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
const controller = showModal("add-post-notice"); const modal = showModal("add-post-notice");
controller.setProperties({ post, resolve, reject }); modal.setProperties({ post, resolve, reject });
}); });
}, },

View File

@ -1,14 +1,13 @@
import { alias } from "@ember/object/computed"; import { alias } from "@ember/object/computed";
import { inject as service } from "@ember/service"; import { inject as service } from "@ember/service";
import { inject } from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
import Controller from "@ember/controller";
import { exportUserArchive } from "discourse/lib/export-csv"; import { exportUserArchive } from "discourse/lib/export-csv";
import { observes } from "discourse-common/utils/decorators"; import { observes } from "discourse-common/utils/decorators";
export default Controller.extend({ export default Controller.extend({
application: inject(), application: controller(),
user: controller(),
router: service(), router: service(),
user: inject(),
userActionType: null, userActionType: null,
canDownloadPosts: alias("user.viewingSelf"), canDownloadPosts: alias("user.viewingSelf"),

View File

@ -1,8 +1,8 @@
import { alias, sort } from "@ember/object/computed"; import { alias, sort } from "@ember/object/computed";
import { inject } from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
import Controller from "@ember/controller";
export default Controller.extend({ export default Controller.extend({
user: inject(), user: controller(),
username: alias("user.model.username_lower"), username: alias("user.model.username_lower"),
sortedBadges: sort("model", "badgeSortOrder"), sortedBadges: sort("model", "badgeSortOrder"),

View File

@ -1,10 +1,9 @@
import { inject as service } from "@ember/service"; import { inject as service } from "@ember/service";
import { inject } from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
import Controller from "@ember/controller";
import DiscourseURL, { userPath, groupPath } from "discourse/lib/url"; import DiscourseURL, { userPath, groupPath } from "discourse/lib/url";
export default Controller.extend({ export default Controller.extend({
topic: inject(), topic: controller(),
router: service(), router: service(),
actions: { actions: {

View File

@ -1,12 +1,11 @@
import { inject } from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
import Controller from "@ember/controller";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
import discourseComputed, { observes } from "discourse-common/utils/decorators"; import discourseComputed, { observes } from "discourse-common/utils/decorators";
import { readOnly } from "@ember/object/computed"; import { readOnly } from "@ember/object/computed";
import { inject as service } from "@ember/service"; import { inject as service } from "@ember/service";
export default Controller.extend({ export default Controller.extend({
application: inject(), application: controller(),
router: service(), router: service(),
currentPath: readOnly("router._router.currentPath"), currentPath: readOnly("router._router.currentPath"),

View File

@ -1,9 +1,8 @@
import { inject } from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
import Controller from "@ember/controller";
import { observes } from "discourse-common/utils/decorators"; import { observes } from "discourse-common/utils/decorators";
export default Controller.extend({ export default Controller.extend({
application: inject(), application: controller(),
@observes("model.canLoadMore") @observes("model.canLoadMore")
_showFooter: function() { _showFooter: function() {

View File

@ -1,14 +1,13 @@
import discourseComputed from "discourse-common/utils/decorators"; import discourseComputed from "discourse-common/utils/decorators";
import { alias, equal, and } from "@ember/object/computed"; import { alias, equal, and } from "@ember/object/computed";
import { inject as service } from "@ember/service"; import { inject as service } from "@ember/service";
import { inject } from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
import Controller from "@ember/controller";
import Topic from "discourse/models/topic"; import Topic from "discourse/models/topic";
export default Controller.extend({ export default Controller.extend({
userTopicsList: controller("user-topics-list"),
user: controller(),
router: service(), router: service(),
userTopicsList: inject("user-topics-list"),
user: inject(),
pmView: false, pmView: false,
viewingSelf: alias("user.viewingSelf"), viewingSelf: alias("user.viewingSelf"),

View File

@ -1,10 +1,9 @@
import discourseComputed, { observes } from "discourse-common/utils/decorators"; import discourseComputed, { observes } from "discourse-common/utils/decorators";
import { inject } from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
import Controller from "@ember/controller";
// Lists of topics on a user's page. // Lists of topics on a user's page.
export default Controller.extend({ export default Controller.extend({
application: inject(), application: controller(),
hideCategory: false, hideCategory: false,
showPosters: false, showPosters: false,

View File

@ -1,11 +1,10 @@
import { equal } from "@ember/object/computed"; import { equal } from "@ember/object/computed";
import { inject } from "@ember/controller"; import Controller, { inject as controller } from "@ember/controller";
import Controller from "@ember/controller";
import discourseDebounce from "discourse/lib/debounce"; import discourseDebounce from "discourse/lib/debounce";
import { observes } from "discourse-common/utils/decorators"; import { observes } from "discourse-common/utils/decorators";
export default Controller.extend({ export default Controller.extend({
application: inject(), application: controller(),
queryParams: ["period", "order", "asc", "name", "group", "exclude_usernames"], queryParams: ["period", "order", "asc", "name", "group", "exclude_usernames"],
period: "weekly", period: "weekly",
order: "likes_received", order: "likes_received",