File tree Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -152,4 +152,8 @@ export default Controller.extend({
152
152
loadDocsBuilds : task ( function * ( ) {
153
153
return yield ajax ( `https://docs.rs/crate/${ this . crate . name } /${ this . currentVersion . num } /builds.json` ) ;
154
154
} ) ,
155
+
156
+ yankVersionTask : task ( function * ( version ) {
157
+ return version . yank . perform ( ) ;
158
+ } ) ,
155
159
} ) ;
Original file line number Diff line number Diff line change @@ -60,4 +60,14 @@ export default class Version extends Model {
60
60
}
61
61
} ) . keepLatest ( ) )
62
62
loadReadmeTask ;
63
+
64
+ @( task ( function * ( ) {
65
+ let response = yield fetch ( `/api/v1/crates/${ this . crate . id } /${ this . num } /yank` , { method : 'DELETE' } ) ;
66
+ if ( ! response . ok ) {
67
+ throw new Error ( `Yank request for ${ this . crateName } v${ this . num } failed` ) ;
68
+ }
69
+
70
+ return yield response . text ( ) ;
71
+ } ) . keepLatest ( ) )
72
+ yank ;
63
73
}
Original file line number Diff line number Diff line change 171
171
{{ #if version.yanked }}
172
172
<span local-class =' yanked' >yanked</span >
173
173
{{ /if }}
174
+ {{ #if isOwner }}
175
+ <button type =" button" local-class =" remove-button" {{ on " click" (perform this.yankVersionTask version )}} >Yank</button >
176
+ {{ /if }}
174
177
</li >
175
178
{{ /each }}
176
179
</ul >
You can’t perform that action at this time.
0 commit comments