Skip to content

Commit c8c8424

Browse files
committed
Auto merge of #2414 - Turbo87:props, r=locks
crate.version: Inline a few computed properties It seems unnecessarily complicated in these cases to use computed properties for these values. r? @locks
2 parents 9cd26fc + ab3cda2 commit c8c8424

File tree

3 files changed

+4
-45
lines changed

3 files changed

+4
-45
lines changed

app/controllers/crate/version.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,13 @@ export default Controller.extend({
2222
crate: alias('model.crate'),
2323
requestedVersion: alias('model.requestedVersion'),
2424
currentVersion: alias('model.version'),
25-
crateTomlText: computed('crate.name', 'currentVersion.num', function () {
26-
return `${this.get('crate.name')} = "${this.get('currentVersion.num')}"`;
27-
}),
25+
2826
keywords: alias('crate.keywords'),
2927
categories: alias('crate.categories'),
3028
badges: alias('crate.badges'),
3129
isOwner: computed('crate.owner_user', 'session.currentUser.id', function () {
3230
return this.get('crate.owner_user').findBy('id', this.get('session.currentUser.id'));
3331
}),
34-
notYankedOrIsOwner: computed('currentVersion', 'crate.owner_user', 'session.currentUser.id', function () {
35-
return !this.currentVersion.yanked || this.get('crate.owner_user').findBy('id', this.get('session.currentUser.id'));
36-
}),
3732

3833
sortedVersions: readOnly('crate.versions'),
3934

app/templates/crate/version.hbs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@
5151
{{else}}
5252
<div local-class='install'>
5353
<div local-class='install-action'>Cargo.toml</div>
54-
<code>{{ this.crateTomlText }}</code>
54+
<code>{{this.crate.name}} = "{{this.currentVersion.num}}"</code>
5555
{{#if (is-clipboard-supported)}}
56-
<CrateTomlCopy @copyText={{this.crateTomlText}} />
56+
<CrateTomlCopy @copyText='{{this.crate.name}} = "{{this.currentVersion.num}}"' />
5757
{{/if}}
5858
</div>
5959
{{#if this.readme}}
@@ -70,7 +70,7 @@
7070
{{/if}}
7171
{{/if}}
7272
</div>
73-
{{#if this.notYankedOrIsOwner}}
73+
{{#if (or this.isOwner (not this.currentVersion.yanked))}}
7474
<section local-class='authorship' aria-label="Crate metadata">
7575
<div local-class='top'>
7676
<div>

tests/unit/controllers/crate/version-test.js

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)