Skip to content

Commit 3bde7dd

Browse files
committed
Show right-hand column on yanked version page to crate owners.
Among other things, this makes the "Manage owners" link available even if all versions of a crate were yanked.
1 parent 293a3fb commit 3bde7dd

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

app/controllers/crate/version.js

+5
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ export default Controller.extend({
3333
isOwner: computed('crate.owner_user', 'session.currentUser.id', function() {
3434
return this.get('crate.owner_user').findBy('id', this.get('session.currentUser.id'));
3535
}),
36+
notYankedOrIsOwner: computed('model', 'crate.owner_user', 'session.currentUser.id', function() {
37+
return (
38+
!this.get('model').yanked || this.get('crate.owner_user').findBy('id', this.get('session.currentUser.id'))
39+
);
40+
}),
3641

3742
sortedVersions: readOnly('crate.versions'),
3843

app/templates/crate/version.hbs

+15-13
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,18 @@
5151
</div>
5252
</div>
5353

54-
{{#if currentVersion.yanked}}
55-
<div class='crate-info'>
56-
<div>
57-
<p>This crate has been yanked, but it is still available for download for
58-
other crates that may be depending on it.</p>
59-
<p>You may wish to
60-
{{#link-to 'crate.versions' crate}}view all versions{{/link-to}} to find one that
61-
has not been yanked.
62-
</p>
63-
</div>
64-
</div>
65-
{{else}}
6654
<div class='crate-info'>
6755
<div class='docs'>
56+
{{#if currentVersion.yanked}}
57+
<p>
58+
This crate has been yanked, but it is still available for download for other crates that
59+
may be depending on it.
60+
</p>
61+
<p>
62+
You may wish to {{#link-to 'crate.versions' crate}}view all versions{{/link-to}} to find
63+
one that has not been yanked.
64+
</p>
65+
{{else}}
6866
<div class='install'>
6967
<div class='action'>Cargo.toml</div>
7068
<code id="crate-toml">{{ crate.name }} = "{{ currentVersion.num }}"</code>
@@ -99,7 +97,9 @@
9997
</div>
10098
{{/if}}
10199
{{/if}}
100+
{{/if}}
102101
</div>
102+
{{#if notYankedOrIsOwner}}
103103
<section class='authorship' aria-label="Crate metadata">
104104
<div class='top'>
105105
<div>
@@ -240,8 +240,10 @@
240240
{{/if}}
241241
</div>
242242
</section>
243+
{{/if}}
243244
</div>
244245

246+
{{#unless currentVersion.yanked}}
245247
<div id='crate-downloads'>
246248
<div class='stats'>
247249
<h3>Stats Overview</h3>
@@ -293,4 +295,4 @@
293295
{{download-graph data=downloadData}}
294296
</div>
295297
</div>
296-
{{/if}}
298+
{{/unless}}

0 commit comments

Comments
 (0)