File tree Expand file tree Collapse file tree 3 files changed +23
-4
lines changed Expand file tree Collapse file tree 3 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -156,4 +156,8 @@ export default Controller.extend({
156
156
yankVersionTask : task ( function * ( version ) {
157
157
return version . yank . perform ( ) ;
158
158
} ) ,
159
+
160
+ unyankVersionTask : task ( function * ( version ) {
161
+ return version . unyank . perform ( ) ;
162
+ } ) ,
159
163
} ) ;
Original file line number Diff line number Diff line change @@ -70,4 +70,14 @@ export default class Version extends Model {
70
70
return yield response . text ( ) ;
71
71
} ) . keepLatest ( ) )
72
72
yank ;
73
+
74
+ @( task ( function * ( ) {
75
+ let response = yield fetch ( `/api/v1/crates/${ this . crate . id } /${ this . num } /unyank` , { method : 'PUT' } ) ;
76
+ if ( ! response . ok ) {
77
+ throw new Error ( `Yank request for ${ this . crateName } v${ this . num } failed` ) ;
78
+ }
79
+
80
+ return yield response . text ( ) ;
81
+ } ) . keepLatest ( ) )
82
+ unyank ;
73
83
}
Original file line number Diff line number Diff line change 168
168
{{ version.num }}
169
169
</LinkTo >
170
170
{{ moment-format version.created_at ' ll' }}
171
- {{ #if version.yanked }}
172
- <span local-class =' yanked' >yanked</span >
173
- {{ /if }}
174
171
{{ #if isOwner }}
175
- <button type =" button" local-class =" remove-button" {{ on " click" (perform this.yankVersionTask version )}} >Yank</button >
172
+ {{ #if version.yanked }}
173
+ <button type =" button" local-class =" remove-button" {{ on " click" (perform this.unyankVersionTask version )}} >Unyank</button >
174
+ {{ else }}
175
+ <button type =" button" local-class =" remove-button" {{ on " click" (perform this.yankVersionTask version )}} >Yank</button >
176
+ {{ /if }}
177
+ {{ else }}
178
+ {{ #if version.yanked }}
179
+ <span local-class =' yanked' >yanked</span >
180
+ {{ /if }}
176
181
{{ /if }}
177
182
</li >
178
183
{{ /each }}
You can’t perform that action at this time.
0 commit comments