Skip to content

Commit 45ec3fb

Browse files
committed
controllers/version/metadata: Fix yanked usage
This was using the previous `yanked` state for the admin log message, instead of the new state.
1 parent cccdd74 commit 45ec3fb

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/controllers/version/metadata.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,11 @@ pub fn perform_version_yank_update(
187187
let user = auth.user();
188188
let owners = krate.owners(conn)?;
189189

190+
let yanked = yanked.unwrap_or(version.yanked);
191+
190192
if Handle::current().block_on(user.rights(state, &owners))? < Rights::Publish {
191193
if user.is_admin {
192-
let action = if version.yanked {
193-
"yanking"
194-
} else {
195-
"unyanking"
196-
};
194+
let action = if yanked { "yanking" } else { "unyanking" };
197195
warn!(
198196
"Admin {} is {action} {}@{}",
199197
user.gh_login, krate.name, version.num
@@ -206,7 +204,6 @@ pub fn perform_version_yank_update(
206204
}
207205
}
208206

209-
let yanked = yanked.unwrap_or(version.yanked);
210207
// Check if the yanked state or yank message has changed and update if necessary
211208
let updated_cnt = diesel::update(
212209
versions::table.find(version.id).filter(
@@ -230,7 +227,7 @@ pub fn perform_version_yank_update(
230227
version.yanked = yanked;
231228
version.yank_message = yank_message;
232229

233-
let action = if version.yanked {
230+
let action = if yanked {
234231
VersionAction::Yank
235232
} else {
236233
VersionAction::Unyank

0 commit comments

Comments
 (0)