From 3acdb17b86c2eb221efd959ef5ab8ee025e6bd12 Mon Sep 17 00:00:00 2001 From: cloudhead Date: Wed, 2 Oct 2024 21:41:39 +0200 Subject: [PATCH] cob: Fix patch review editing Due to the way review editing was implemented, we were losing comments on previous review edits. Here, we add a new `review.edit` action that is specifically for editing, and make the existing `review` action fail silently (for backwards compatibility) in case it is used when there is already a review. We also simplify the review data structure by only keeping track of one review per author per revision, instead of all edits. Later, if needed, it will be possible to keep track of all review edits. --- radicle/src/cob/patch.rs | 239 ++++++++++++++++++++++++++++++--------- 1 file changed, 187 insertions(+), 52 deletions(-) diff --git a/radicle/src/cob/patch.rs b/radicle/src/cob/patch.rs index b83f2ebc..4c22bf3c 100644 --- a/radicle/src/cob/patch.rs +++ b/radicle/src/cob/patch.rs @@ -1,5 +1,6 @@ pub mod cache; +use std::collections::btree_map; use std::collections::{BTreeMap, BTreeSet, HashMap}; use std::fmt; use std::ops::Deref; @@ -185,6 +186,16 @@ pub enum Action { #[serde(default, skip_serializing_if = "Vec::is_empty")] labels: Vec