bin: Fix broken review loading in patch review

This commit is contained in:
Erik Kundt
2024-11-20 16:45:23 +01:00
parent 3cddf52c35
commit 391128cba8
2 changed files with 6 additions and 9 deletions
+3 -6
View File
@@ -90,14 +90,11 @@ pub fn find_review<'a, G: Signer>(
patch: &'a Patch,
revision: &Revision,
signer: &G,
) -> Result<Option<(ReviewId, &'a Review)>> {
match patch
) -> Option<(ReviewId, &'a Review)> {
patch
.reviews_of(revision.id())
.find(|(_, review)| review.author().public_key() == signer.public_key())
{
Some((id, review)) => Ok(Some((id.clone(), review))),
None => anyhow::bail!("Could not find review by me"),
}
.map(|(id, review)| (id.clone(), review))
}
#[cfg(test)]
+3 -3
View File
@@ -344,7 +344,7 @@ mod interface {
return Ok(());
};
if let Some((id, _)) = patch::find_review(&patch, revision, &signer)? {
if let Some((id, _)) = patch::find_review(&patch, revision, &signer) {
// Review already started, resume.
log::info!("Resuming review {id}..");
} else {
@@ -365,8 +365,8 @@ mod interface {
loop {
// Reload review
let (review_id, review) = patch::find_review(&patch, revision, &signer)?
.ok_or_else(|| anyhow!("Could not load review by me"))?;
let (review_id, review) = patch::find_review(&patch, revision, &signer)
.ok_or_else(|| anyhow!("Could not find review."))?;
log::info!(
"Found comments for {review_id}: {:?}",