diff --git a/.eslintrc.js b/.eslintrc.js index 25d75ae4de8..f9b48a7e40b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -21,7 +21,6 @@ module.exports = { 'ember/no-classic-classes': 'error', 'ember/no-empty-attrs': 'off', - 'ember/no-get': 'off', 'ember/require-computed-property-dependencies': 'off', 'import-helpers/order-imports': [ diff --git a/app/controllers/crate/owners.js b/app/controllers/crate/owners.js index 4ad621728d1..887d30dfdc6 100644 --- a/app/controllers/crate/owners.js +++ b/app/controllers/crate/owners.js @@ -42,11 +42,11 @@ export default class CrateOwnersController extends Controller { switch (owner.kind) { case 'user': this.set('removed', `User ${owner.get('login')} removed as crate owner`); - this.get('crate.owner_user').removeObject(owner); + this.crate.owner_user.removeObject(owner); break; case 'team': this.set('removed', `Team ${owner.get('display_name')} removed as crate owner`); - this.get('crate.owner_team').removeObject(owner); + this.crate.owner_team.removeObject(owner); break; } } catch (error) { diff --git a/app/controllers/crate/version.js b/app/controllers/crate/version.js index 2cf2fbf1e66..e5ae64b0b76 100644 --- a/app/controllers/crate/version.js +++ b/app/controllers/crate/version.js @@ -28,7 +28,7 @@ export default class CrateVersionController extends Controller { @computed('crate.owner_user', 'session.currentUser.id') get isOwner() { - return this.get('crate.owner_user').findBy('id', this.get('session.currentUser.id')); + return this.crate.owner_user.findBy('id', this.session.currentUser?.id); } @readOnly('crate.versions') sortedVersions; diff --git a/app/controllers/crate/versions.js b/app/controllers/crate/versions.js index 48c56c484dd..fc43b600fb2 100644 --- a/app/controllers/crate/versions.js +++ b/app/controllers/crate/versions.js @@ -7,6 +7,6 @@ export default class CrateVersionsController extends Controller { @computed('model.owner_user', 'session.currentUser.id') get isOwner() { - return this.get('model.owner_user').findBy('id', this.get('session.currentUser.id')); + return this.model.owner_user.findBy('id', this.session.currentUser?.id); } } diff --git a/app/controllers/dashboard.js b/app/controllers/dashboard.js index be72315deab..c4efbcff998 100644 --- a/app/controllers/dashboard.js +++ b/app/controllers/dashboard.js @@ -29,12 +29,12 @@ export default class DashboardController extends Controller { @computed('myCrates.[]') get hasMoreCrates() { - return this.get('myCrates.length') > TO_SHOW; + return this.myCrates.length > TO_SHOW; } @computed('myFollowing.[]') get hasMoreFollowing() { - return this.get('myFollowing.length') > TO_SHOW; + return this.myFollowing.length > TO_SHOW; } @task(function* () { diff --git a/app/controllers/index.js b/app/controllers/index.js index db97d3dd5e0..a2b90a8164b 100644 --- a/app/controllers/index.js +++ b/app/controllers/index.js @@ -12,7 +12,7 @@ export default class IndexController extends Controller { @computed('dataTask.{lastSuccessful,isRunning}') get hasData() { - return this.get('dataTask.lastSuccessful') && !this.get('dataTask.isRunning'); + return this.dataTask.lastSuccessful && !this.dataTask.isRunning; } @(task(function* () { diff --git a/app/controllers/me/index.js b/app/controllers/me/index.js index f1bea45b157..74675595a72 100644 --- a/app/controllers/me/index.js +++ b/app/controllers/me/index.js @@ -28,7 +28,7 @@ export default class MeIndexController extends Controller { } setAllEmailNotifications(value) { - this.get('ownedCrates').forEach(c => { + this.ownedCrates.forEach(c => { c.set('email_notifications', value); }); } @@ -41,7 +41,7 @@ export default class MeIndexController extends Controller { await ajax(`/api/v1/me/email_notifications`, { method: 'PUT', body: JSON.stringify( - this.get('ownedCrates').map(c => ({ + this.ownedCrates.map(c => ({ id: parseInt(c.id, 10), email_notifications: c.email_notifications, })), diff --git a/app/controllers/search.js b/app/controllers/search.js index cfd5fe3c244..9cc73fb4920 100644 --- a/app/controllers/search.js +++ b/app/controllers/search.js @@ -16,12 +16,12 @@ export default class SearchController extends Controller { @computed('dataTask.{lastSuccessful,isRunning}') get hasData() { - return this.get('dataTask.lastSuccessful') || !this.get('dataTask.isRunning'); + return this.dataTask.lastSuccessful || !this.dataTask.isRunning; } @computed('dataTask.{lastSuccessful,isRunning}') get firstResultPending() { - return !this.get('dataTask.lastSuccessful') && this.get('dataTask.isRunning'); + return !this.dataTask.lastSuccessful && this.dataTask.isRunning; } @readOnly('model.meta.total') totalItems; diff --git a/app/models/team.js b/app/models/team.js index 48686754fdb..649d368f18a 100644 --- a/app/models/team.js +++ b/app/models/team.js @@ -18,8 +18,7 @@ export default class Team extends Model { org_name; @computed('name', 'org_name', function () { - let { name, org_name } = this.getProperties('name', 'org_name'); - return `${org_name}/${name}`; + return `${this.org_name}/${this.name}`; }) display_name; } diff --git a/app/models/version.js b/app/models/version.js index 25eafa70f4f..59964c95be4 100644 --- a/app/models/version.js +++ b/app/models/version.js @@ -29,7 +29,8 @@ export default class Version extends Model { @alias('loadAuthorsTask.last.value') authorNames; @(task(function* () { - let authors = yield this.get('authors'); + // trigger the async relationship to load the content + let authors = yield this.authors; return authors.meta.names; }).keepLatest()) loadAuthorsTask; @@ -39,7 +40,8 @@ export default class Version extends Model { @alias('loadDepsTask.last.value.dev') devDependencies; @(task(function* () { - let dependencies = yield this.get('dependencies'); + // trigger the async relationship to load the content + let dependencies = yield this.dependencies; let normal = dependencies.filterBy('kind', 'normal').uniqBy('crate_id'); let build = dependencies.filterBy('kind', 'build').uniqBy('crate_id'); diff --git a/app/routes/me/crates.js b/app/routes/me/crates.js index 9a10cd5fc3b..7ea1c590137 100644 --- a/app/routes/me/crates.js +++ b/app/routes/me/crates.js @@ -7,7 +7,7 @@ export default class MeCratesRoute extends AuthenticatedRoute { }; model(params) { - params.user_id = this.get('session.currentUser.id'); + params.user_id = this.session.currentUser.id; return this.store.query('crate', params); } }