From 6451eb7637235a68df1e991f0f532d78d1f6f470 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Thu, 28 Apr 2016 16:49:24 -0400 Subject: [PATCH] `.@each` on leafs is deprecated in favor of `.[]` --- app/assets/javascripts/admin/controllers/admin-api.js.es6 | 2 +- .../admin/controllers/admin-user-badges.js.es6 | 4 ++-- .../javascripts/admin/controllers/admin-user-index.js.es6 | 2 +- .../javascripts/admin/views/admin-backups-logs.js.es6 | 2 +- .../discourse/components/basic-topic-list.js.es6 | 2 +- .../javascripts/discourse/components/combo-box.js.es6 | 2 +- .../discourse/controllers/create-account.js.es6 | 4 ++-- .../discourse/controllers/group/members.js.es6 | 2 +- app/assets/javascripts/discourse/controllers/login.js.es6 | 2 +- .../javascripts/discourse/controllers/user-card.js.es6 | 2 +- .../discourse/controllers/user-private-messages.js.es6 | 2 +- .../javascripts/discourse/models/post-stream.js.es6 | 8 ++++---- app/assets/javascripts/discourse/models/site.js.es6 | 4 ++-- app/assets/javascripts/discourse/models/topic.js.es6 | 2 +- .../javascripts/discourse/models/user-action.js.es6 | 8 ++++---- app/assets/javascripts/discourse/models/user.js.es6 | 2 +- .../javascripts/discourse/views/topic-progress.js.es6 | 2 +- 17 files changed, 26 insertions(+), 26 deletions(-) diff --git a/app/assets/javascripts/admin/controllers/admin-api.js.es6 b/app/assets/javascripts/admin/controllers/admin-api.js.es6 index 1bb0a7dc2..82366d3bd 100644 --- a/app/assets/javascripts/admin/controllers/admin-api.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-api.js.es6 @@ -63,6 +63,6 @@ export default Ember.ArrayController.extend({ **/ hasMasterKey: function() { return !!this.get('model').findBy('user', null); - }.property('model.@each') + }.property('model.[]') }); 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 8d919e5f2..c8c0ba621 100644 --- a/app/assets/javascripts/admin/controllers/admin-user-badges.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-user-badges.js.es6 @@ -40,7 +40,7 @@ export default Ember.ArrayController.extend({ return _(expanded).sortBy(group => group.granted_at).reverse().value(); - }.property('model', 'model.@each', 'model.expandedBadges.@each'), + }.property('model', 'model.[]', 'model.expandedBadges.[]'), /** Array of badges that have not been granted to this user. @@ -62,7 +62,7 @@ export default Ember.ArrayController.extend({ }); return _.sortBy(badges, badge => badge.get('name')); - }.property('badges.@each', 'model.@each'), + }.property('badges.[]', 'model.[]'), /** Whether there are any badges that can be granted. diff --git a/app/assets/javascripts/admin/controllers/admin-user-index.js.es6 b/app/assets/javascripts/admin/controllers/admin-user-index.js.es6 index 454aa96f8..a5e34fc25 100644 --- a/app/assets/javascripts/admin/controllers/admin-user-index.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-user-index.js.es6 @@ -27,7 +27,7 @@ export default Ember.Controller.extend(CanCheckEmails, { }); } return []; - }.property('model.user_fields.@each'), + }.property('model.user_fields.[]'), actions: { toggleTitleEdit() { diff --git a/app/assets/javascripts/admin/views/admin-backups-logs.js.es6 b/app/assets/javascripts/admin/views/admin-backups-logs.js.es6 index c5ba44e27..cb838a48f 100644 --- a/app/assets/javascripts/admin/views/admin-backups-logs.js.es6 +++ b/app/assets/javascripts/admin/views/admin-backups-logs.js.es6 @@ -27,7 +27,7 @@ export default Ember.View.extend({ // force rerender this.rerender(); } - }, 150).observes("controller.model.@each"), + }, 150).observes("controller.model.[]"), render(buffer) { const formattedLogs = this.get("formattedLogs"); diff --git a/app/assets/javascripts/discourse/components/basic-topic-list.js.es6 b/app/assets/javascripts/discourse/components/basic-topic-list.js.es6 index 53ebb014b..75c4d370c 100644 --- a/app/assets/javascripts/discourse/components/basic-topic-list.js.es6 +++ b/app/assets/javascripts/discourse/components/basic-topic-list.js.es6 @@ -13,7 +13,7 @@ export default Ember.Component.extend({ _topicListChanged: function() { this._initFromTopicList(this.get('topicList')); - }.observes('topicList.@each'), + }.observes('topicList.[]'), _initFromTopicList(topicList) { if (topicList !== null) { diff --git a/app/assets/javascripts/discourse/components/combo-box.js.es6 b/app/assets/javascripts/discourse/components/combo-box.js.es6 index 83b9290bf..e023ad267 100644 --- a/app/assets/javascripts/discourse/components/combo-box.js.es6 +++ b/app/assets/javascripts/discourse/components/combo-box.js.es6 @@ -46,7 +46,7 @@ export default Ember.Component.extend({ } }, - @observes('content.@each') + @observes('content.[]') _rerenderOnChange() { this.rerender(); }, diff --git a/app/assets/javascripts/discourse/controllers/create-account.js.es6 b/app/assets/javascripts/discourse/controllers/create-account.js.es6 index bc6ccf62a..9ff65be62 100644 --- a/app/assets/javascripts/discourse/controllers/create-account.js.es6 +++ b/app/assets/javascripts/discourse/controllers/create-account.js.es6 @@ -127,7 +127,7 @@ export default Ember.Controller.extend(ModalFunctionality, { failed: true, reason: I18n.t('user.email.invalid') }); - }.property('accountEmail', 'rejectedEmails.@each'), + }.property('accountEmail', 'rejectedEmails.[]'), emailValidated: function() { return this.get('authOptions.email') === this.get("accountEmail") && this.get('authOptions.email_valid'); @@ -326,7 +326,7 @@ export default Ember.Controller.extend(ModalFunctionality, { ok: true, reason: I18n.t('user.password.ok') }); - }.property('accountPassword', 'rejectedPasswords.@each', 'accountUsername', 'accountEmail', 'isDeveloper'), + }.property('accountPassword', 'rejectedPasswords.[]', 'accountUsername', 'accountEmail', 'isDeveloper'), @on('init') fetchConfirmationValue() { diff --git a/app/assets/javascripts/discourse/controllers/group/members.js.es6 b/app/assets/javascripts/discourse/controllers/group/members.js.es6 index 09c4b9a63..306ff8aa8 100644 --- a/app/assets/javascripts/discourse/controllers/group/members.js.es6 +++ b/app/assets/javascripts/discourse/controllers/group/members.js.es6 @@ -7,7 +7,7 @@ export default Ember.Controller.extend({ limit: null, offset: null, - @computed('model.owners.@each') + @computed('model.owners.[]') isOwner(owners) { if (this.get('currentUser.admin')) { return true; diff --git a/app/assets/javascripts/discourse/controllers/login.js.es6 b/app/assets/javascripts/discourse/controllers/login.js.es6 index 02969cf5e..d85d449ac 100644 --- a/app/assets/javascripts/discourse/controllers/login.js.es6 +++ b/app/assets/javascripts/discourse/controllers/login.js.es6 @@ -27,7 +27,7 @@ export default Ember.Controller.extend(ModalFunctionality, { **/ hasAtLeastOneLoginButton: function() { return Em.get("Discourse.LoginMethod.all").length > 0; - }.property("Discourse.LoginMethod.all.@each"), + }.property("Discourse.LoginMethod.all.[]"), loginButtonText: function() { return this.get('loggingIn') ? I18n.t('login.logging_in') : I18n.t('login.title'); diff --git a/app/assets/javascripts/discourse/controllers/user-card.js.es6 b/app/assets/javascripts/discourse/controllers/user-card.js.es6 index 39d938b8c..0001f1c23 100644 --- a/app/assets/javascripts/discourse/controllers/user-card.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user-card.js.es6 @@ -49,7 +49,7 @@ export default Ember.Controller.extend({ moreBadgesCount: function() { return this.get('user.badge_count') - this.get('user.featured_user_badges.length'); - }.property('user.badge_count', 'user.featured_user_badges.@each'), + }.property('user.badge_count', 'user.featured_user_badges.[]'), hasCardBadgeImage: function() { const img = this.get('user.card_badge.image'); 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 06a1be30d..18f010adc 100644 --- a/app/assets/javascripts/discourse/controllers/user-private-messages.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user-private-messages.js.es6 @@ -15,7 +15,7 @@ export default Ember.Controller.extend({ Discourse.User.currentProp('can_send_private_messages'); }.property('controllers.user.viewingSelf'), - @computed('selected.@each', 'bulkSelectEnabled') + @computed('selected.[]', 'bulkSelectEnabled') hasSelection(selected, bulkSelectEnabled){ return bulkSelectEnabled && selected && selected.length > 0; }, diff --git a/app/assets/javascripts/discourse/models/post-stream.js.es6 b/app/assets/javascripts/discourse/models/post-stream.js.es6 index 1555118be..75e9ef238 100644 --- a/app/assets/javascripts/discourse/models/post-stream.js.es6 +++ b/app/assets/javascripts/discourse/models/post-stream.js.es6 @@ -40,7 +40,7 @@ export default RestModel.extend({ notLoading: Ember.computed.not('loading'), filteredPostsCount: Ember.computed.alias("stream.length"), - @computed('posts.@each') + @computed('posts.[]') hasPosts() { return this.get('posts.length') > 0; }, @@ -53,7 +53,7 @@ export default RestModel.extend({ canAppendMore: Ember.computed.and('notLoading', 'hasPosts', 'lastPostNotLoaded'), canPrependMore: Ember.computed.and('notLoading', 'hasPosts', 'firstPostNotLoaded'), - @computed('hasLoadedData', 'firstPostId', 'posts.@each') + @computed('hasLoadedData', 'firstPostId', 'posts.[]') firstPostPresent(hasLoadedData, firstPostId) { if (!hasLoadedData) { return false; } return !!this.get('posts').findProperty('id', firstPostId); @@ -101,7 +101,7 @@ export default RestModel.extend({ Returns the window of posts above the current set in the stream, bound to the top of the stream. This is the collection we'll ask for when scrolling upwards. **/ - @computed('posts.@each', 'stream.@each') + @computed('posts.[]', 'stream.[]') previousWindow() { // If we can't find the last post loaded, bail const firstPost = _.first(this.get('posts')); @@ -121,7 +121,7 @@ export default RestModel.extend({ Returns the window of posts below the current set in the stream, bound by the bottom of the stream. This is the collection we use when scrolling downwards. **/ - @computed('posts.lastObject', 'stream.@each') + @computed('posts.lastObject', 'stream.[]') nextWindow(lastLoadedPost) { // If we can't find the last post loaded, bail if (!lastLoadedPost) { return []; } diff --git a/app/assets/javascripts/discourse/models/site.js.es6 b/app/assets/javascripts/discourse/models/site.js.es6 index 76d9d49e7..37c129904 100644 --- a/app/assets/javascripts/discourse/models/site.js.es6 +++ b/app/assets/javascripts/discourse/models/site.js.es6 @@ -15,7 +15,7 @@ const Site = RestModel.extend({ return result; }, - @computed("post_action_types.@each") + @computed("post_action_types.[]") flagTypes() { const postActionTypes = this.get('post_action_types'); if (!postActionTypes) return []; @@ -26,7 +26,7 @@ const Site = RestModel.extend({ categoriesByCount: Ember.computed.sort('categories', 'topicCountDesc'), // Sort subcategories under parents - @computed("categoriesByCount", "categories.@each") + @computed("categoriesByCount", "categories.[]") sortedCategories(cats) { const result = [], remaining = {}; diff --git a/app/assets/javascripts/discourse/models/topic.js.es6 b/app/assets/javascripts/discourse/models/topic.js.es6 index 888f09838..949386c9f 100644 --- a/app/assets/javascripts/discourse/models/topic.js.es6 +++ b/app/assets/javascripts/discourse/models/topic.js.es6 @@ -32,7 +32,7 @@ const Topic = RestModel.extend({ return poster && poster.user; }, - @computed('posters.@each') + @computed('posters.[]') lastPoster(posters) { var user; if (posters && posters.length > 0) { diff --git a/app/assets/javascripts/discourse/models/user-action.js.es6 b/app/assets/javascripts/discourse/models/user-action.js.es6 index 50af40254..a4e784bd2 100644 --- a/app/assets/javascripts/discourse/models/user-action.js.es6 +++ b/app/assets/javascripts/discourse/models/user-action.js.es6 @@ -147,10 +147,10 @@ const UserAction = RestModel.extend({ } return rval; }.property("childGroups", - "childGroups.likes.items", "childGroups.likes.items.@each", - "childGroups.stars.items", "childGroups.stars.items.@each", - "childGroups.edits.items", "childGroups.edits.items.@each", - "childGroups.bookmarks.items", "childGroups.bookmarks.items.@each"), + "childGroups.likes.items", "childGroups.likes.items.[]", + "childGroups.stars.items", "childGroups.stars.items.[]", + "childGroups.edits.items", "childGroups.edits.items.[]", + "childGroups.bookmarks.items", "childGroups.bookmarks.items.[]"), switchToActing() { this.setProperties({ diff --git a/app/assets/javascripts/discourse/models/user.js.es6 b/app/assets/javascripts/discourse/models/user.js.es6 index 6e0d2aa41..55456dfb1 100644 --- a/app/assets/javascripts/discourse/models/user.js.es6 +++ b/app/assets/javascripts/discourse/models/user.js.es6 @@ -229,7 +229,7 @@ const User = RestModel.extend({ ua.action_type === UserAction.TYPES.topics; }, - @computed("groups.@each") + @computed("groups.[]") displayGroups() { const groups = this.get('groups'); const filtered = groups.filter(group => { diff --git a/app/assets/javascripts/discourse/views/topic-progress.js.es6 b/app/assets/javascripts/discourse/views/topic-progress.js.es6 index 7454c99d2..7d16f9963 100644 --- a/app/assets/javascripts/discourse/views/topic-progress.js.es6 +++ b/app/assets/javascripts/discourse/views/topic-progress.js.es6 @@ -23,7 +23,7 @@ export default Ember.View.extend({ _updateBar: function() { Em.run.scheduleOnce('afterRender', this, '_updateProgressBar'); - }.observes('controller.streamPercentage', 'controller.model.postStream.stream.@each').on('init'), + }.observes('controller.streamPercentage', 'controller.model.postStream.stream.[]').on('init'), _updateProgressBar: function() { // speeds up stuff, bypass jquery slowness and extra checks