Skip to content

Commit f0c0275

Browse files
committed
Auto merge of #2776 - Turbo87:get, r=locks
Remove unnecessary `this.get()` calls These should not be necessary anymore AFAICT Resolves #1795 r? `@locks`
2 parents 9102eb2 + 21d2bc3 commit f0c0275

File tree

11 files changed

+17
-17
lines changed

11 files changed

+17
-17
lines changed

.eslintrc.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ module.exports = {
2121

2222
'ember/no-classic-classes': 'error',
2323
'ember/no-empty-attrs': 'off',
24-
'ember/no-get': 'off',
2524
'ember/require-computed-property-dependencies': 'off',
2625

2726
'import-helpers/order-imports': [

app/controllers/crate/owners.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ export default class CrateOwnersController extends Controller {
4242
switch (owner.kind) {
4343
case 'user':
4444
this.set('removed', `User ${owner.get('login')} removed as crate owner`);
45-
this.get('crate.owner_user').removeObject(owner);
45+
this.crate.owner_user.removeObject(owner);
4646
break;
4747
case 'team':
4848
this.set('removed', `Team ${owner.get('display_name')} removed as crate owner`);
49-
this.get('crate.owner_team').removeObject(owner);
49+
this.crate.owner_team.removeObject(owner);
5050
break;
5151
}
5252
} catch (error) {

app/controllers/crate/version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default class CrateVersionController extends Controller {
2828

2929
@computed('crate.owner_user', 'session.currentUser.id')
3030
get isOwner() {
31-
return this.get('crate.owner_user').findBy('id', this.get('session.currentUser.id'));
31+
return this.crate.owner_user.findBy('id', this.session.currentUser?.id);
3232
}
3333

3434
@readOnly('crate.versions') sortedVersions;

app/controllers/crate/versions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ export default class CrateVersionsController extends Controller {
77

88
@computed('model.owner_user', 'session.currentUser.id')
99
get isOwner() {
10-
return this.get('model.owner_user').findBy('id', this.get('session.currentUser.id'));
10+
return this.model.owner_user.findBy('id', this.session.currentUser?.id);
1111
}
1212
}

app/controllers/dashboard.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ export default class DashboardController extends Controller {
2929

3030
@computed('myCrates.[]')
3131
get hasMoreCrates() {
32-
return this.get('myCrates.length') > TO_SHOW;
32+
return this.myCrates.length > TO_SHOW;
3333
}
3434

3535
@computed('myFollowing.[]')
3636
get hasMoreFollowing() {
37-
return this.get('myFollowing.length') > TO_SHOW;
37+
return this.myFollowing.length > TO_SHOW;
3838
}
3939

4040
@task(function* () {

app/controllers/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default class IndexController extends Controller {
1212

1313
@computed('dataTask.{lastSuccessful,isRunning}')
1414
get hasData() {
15-
return this.get('dataTask.lastSuccessful') && !this.get('dataTask.isRunning');
15+
return this.dataTask.lastSuccessful && !this.dataTask.isRunning;
1616
}
1717

1818
@(task(function* () {

app/controllers/me/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default class MeIndexController extends Controller {
2828
}
2929

3030
setAllEmailNotifications(value) {
31-
this.get('ownedCrates').forEach(c => {
31+
this.ownedCrates.forEach(c => {
3232
c.set('email_notifications', value);
3333
});
3434
}
@@ -41,7 +41,7 @@ export default class MeIndexController extends Controller {
4141
await ajax(`/api/v1/me/email_notifications`, {
4242
method: 'PUT',
4343
body: JSON.stringify(
44-
this.get('ownedCrates').map(c => ({
44+
this.ownedCrates.map(c => ({
4545
id: parseInt(c.id, 10),
4646
email_notifications: c.email_notifications,
4747
})),

app/controllers/search.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ export default class SearchController extends Controller {
1616

1717
@computed('dataTask.{lastSuccessful,isRunning}')
1818
get hasData() {
19-
return this.get('dataTask.lastSuccessful') || !this.get('dataTask.isRunning');
19+
return this.dataTask.lastSuccessful || !this.dataTask.isRunning;
2020
}
2121

2222
@computed('dataTask.{lastSuccessful,isRunning}')
2323
get firstResultPending() {
24-
return !this.get('dataTask.lastSuccessful') && this.get('dataTask.isRunning');
24+
return !this.dataTask.lastSuccessful && this.dataTask.isRunning;
2525
}
2626

2727
@readOnly('model.meta.total') totalItems;

app/models/team.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ export default class Team extends Model {
1818
org_name;
1919

2020
@computed('name', 'org_name', function () {
21-
let { name, org_name } = this.getProperties('name', 'org_name');
22-
return `${org_name}/${name}`;
21+
return `${this.org_name}/${this.name}`;
2322
})
2423
display_name;
2524
}

app/models/version.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ export default class Version extends Model {
2929
@alias('loadAuthorsTask.last.value') authorNames;
3030

3131
@(task(function* () {
32-
let authors = yield this.get('authors');
32+
// trigger the async relationship to load the content
33+
let authors = yield this.authors;
3334
return authors.meta.names;
3435
}).keepLatest())
3536
loadAuthorsTask;
@@ -39,7 +40,8 @@ export default class Version extends Model {
3940
@alias('loadDepsTask.last.value.dev') devDependencies;
4041

4142
@(task(function* () {
42-
let dependencies = yield this.get('dependencies');
43+
// trigger the async relationship to load the content
44+
let dependencies = yield this.dependencies;
4345

4446
let normal = dependencies.filterBy('kind', 'normal').uniqBy('crate_id');
4547
let build = dependencies.filterBy('kind', 'build').uniqBy('crate_id');

app/routes/me/crates.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default class MeCratesRoute extends AuthenticatedRoute {
77
};
88

99
model(params) {
10-
params.user_id = this.get('session.currentUser.id');
10+
params.user_id = this.session.currentUser.id;
1111
return this.store.query('crate', params);
1212
}
1313
}

0 commit comments

Comments
 (0)