diff --git a/Cargo.lock b/Cargo.lock index cb4ddf3ce..965901316 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3937,9 +3937,9 @@ checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" [[package]] name = "radicle" -version = "0.15.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fbbbde9fb67cc5264a38ba0f106b55892a1aeb8c8ca9023ec36a6b7e0442700" +checksum = "d5fe953b25a8f5c24baf1019f746912e7453746d617a1af04cb347904d241005" dependencies = [ "amplify", "base64 0.21.7", @@ -3953,13 +3953,13 @@ dependencies = [ "log", "multibase", "nonempty", - "once_cell", "qcheck", "radicle-cob", "radicle-crypto", "radicle-git-ext", "radicle-ssh", "serde", + "serde-untagged", "serde_json", "siphasher 1.0.1", "sqlite", diff --git a/crates/radicle-tauri/Cargo.toml b/crates/radicle-tauri/Cargo.toml index 8642b882a..14f2cf595 100644 --- a/crates/radicle-tauri/Cargo.toml +++ b/crates/radicle-tauri/Cargo.toml @@ -20,7 +20,7 @@ base64 = { version = "0.22.1" } either = { version = "1.15" } infer = { version = "0.19.0" } log = { version = "0.4.22" } -radicle = { version = "0.15.0" } +radicle = { version = "0.16.1" } radicle-types = { version = "0.1.0", path = "../radicle-types" } radicle-surf = { version = "0.22.1", features = ["serde"] } serde = { version = "1.0.0", features = ["derive"] } diff --git a/crates/radicle-types/Cargo.toml b/crates/radicle-types/Cargo.toml index 0aa9554fd..88b6bfc90 100644 --- a/crates/radicle-types/Cargo.toml +++ b/crates/radicle-types/Cargo.toml @@ -11,7 +11,7 @@ localtime = { version = "1.3.1" } log = { version = "0.4.22" } infer = { version = "0.19.0" } mime-infer = { version = "3.0.0" } -radicle = { version = "0.15.0" } +radicle = { version = "0.16.1" } radicle-surf = { version = "0.22.1", features = ["serde"] } serde = { version = "1.0.0", features = ["derive"] } serde_json = { version = "1.0.0" } @@ -48,4 +48,4 @@ ts-rs = { version = "10.1.0", features = [ url = { version = "2.5.4", features = ["serde"] } [dev-dependencies] -radicle = { version = "0.15.0", features = ["test"] } +radicle = { version = "0.16.1", features = ["test"] } diff --git a/crates/radicle-types/bindings/cob/patch/Action.ts b/crates/radicle-types/bindings/cob/patch/Action.ts index 5daf64c45..8c57991b9 100644 --- a/crates/radicle-types/bindings/cob/patch/Action.ts +++ b/crates/radicle-types/bindings/cob/patch/Action.ts @@ -23,6 +23,7 @@ export type Action = summary?: string; verdict?: Verdict; labels?: Array; + embeds?: Array | null; } | { "type": "review.redact"; review: string } | { @@ -50,6 +51,12 @@ export type Action = } | { "type": "review.comment.resolve"; review: string; comment: string } | { "type": "review.comment.unresolve"; review: string; comment: string } + | { + "type": "review.react"; + review: string; + reaction: string; + active: boolean; + } | { "type": "revision"; description: string; diff --git a/crates/radicle-types/bindings/cob/patch/Review.ts b/crates/radicle-types/bindings/cob/patch/Review.ts index 93ec0f27b..53bcaf083 100644 --- a/crates/radicle-types/bindings/cob/patch/Review.ts +++ b/crates/radicle-types/bindings/cob/patch/Review.ts @@ -8,7 +8,7 @@ export type Review = { id: string; author: Author; verdict?: Verdict; - summary?: string; + summary: string; comments: Array>; timestamp: number; labels: Array; diff --git a/crates/radicle-types/bindings/cob/patch/ReviewEdit.ts b/crates/radicle-types/bindings/cob/patch/ReviewEdit.ts deleted file mode 100644 index 35b5f7ef3..000000000 --- a/crates/radicle-types/bindings/cob/patch/ReviewEdit.ts +++ /dev/null @@ -1,9 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { Verdict } from "./Verdict"; - -export type ReviewEdit = { - reviewId: string; - verdict?: Verdict; - summary?: string; - labels?: Array; -}; diff --git a/crates/radicle-types/src/domain/patch/models/patch.rs b/crates/radicle-types/src/domain/patch/models/patch.rs index 4416e54d5..bb8676ff6 100644 --- a/crates/radicle-types/src/domain/patch/models/patch.rs +++ b/crates/radicle-types/src/domain/patch/models/patch.rs @@ -115,23 +115,6 @@ impl From for State { } } -#[derive(Serialize, Deserialize, TS)] -#[serde(rename_all = "camelCase")] -#[ts(export)] -#[ts(export_to = "cob/patch/")] -pub struct ReviewEdit { - #[ts(as = "String")] - pub review_id: cob::patch::ReviewId, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(optional)] - pub verdict: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(optional)] - pub summary: Option, - #[ts(as = "Option>", optional)] - pub labels: Vec, -} - #[derive(Serialize, TS)] #[serde(rename_all = "camelCase")] #[ts(export)] @@ -252,9 +235,7 @@ pub struct Review { #[serde(default, skip_serializing_if = "Option::is_none")] #[ts(optional)] verdict: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(optional)] - summary: Option, + summary: String, comments: Vec>, #[ts(type = "number")] timestamp: cob::common::Timestamp, @@ -268,7 +249,7 @@ impl Review { id: review.id(), author: cobs::Author::new(&review.author().id, aliases), verdict: review.verdict().map(|v| v.into()), - summary: review.summary().map(|s| s.to_string()), + summary: review.summary().to_string(), labels: review.labels().cloned().collect::>(), comments: review .comments() @@ -370,6 +351,9 @@ pub enum Action { #[serde(default, skip_serializing_if = "Vec::is_empty")] #[ts(as = "Option>", optional)] labels: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(as = "Option<_>", optional)] + embeds: Option>, }, #[serde(rename = "review.redact")] ReviewRedact { @@ -433,6 +417,14 @@ pub enum Action { #[ts(as = "String")] comment: cob::EntryId, }, + #[serde(rename = "review.react")] + ReviewReact { + #[ts(as = "String")] + review: patch::ReviewId, + #[ts(as = "String")] + reaction: cob::Reaction, + active: bool, + }, #[serde(rename = "revision")] Revision { @@ -657,16 +649,24 @@ impl FromRadicleAction for Action { radicle::patch::Action::ReviewCommentUnresolve { review, comment } => { Self::ReviewCommentUnresolve { review, comment } } - radicle::patch::Action::ReviewEdit { + radicle::patch::Action::ReviewReact { review, - summary, - verdict, - labels, - } => Self::ReviewEdit { + reaction, + active, + } => Self::ReviewReact { review, - summary, - verdict: verdict.map(Into::into), - labels, + reaction, + active, + }, + radicle::patch::Action::ReviewEdit(review) => Self::ReviewEdit { + review: *review.review_id(), + summary: review.summary().cloned(), + verdict: review.verdict().cloned().map(Into::into), + labels: review.labels().to_vec(), + embeds: review + .embeds() + .cloned() + .map(|s| s.into_iter().map(Into::into).collect::>()), }, } } diff --git a/crates/radicle-types/src/traits/patch.rs b/crates/radicle-types/src/traits/patch.rs index 3e0096ce9..be69630b7 100644 --- a/crates/radicle-types/src/traits/patch.rs +++ b/crates/radicle-types/src/traits/patch.rs @@ -147,8 +147,27 @@ pub trait PatchesMut: Profile { summary, verdict, labels, + embeds, } => { - patch.review_edit(review, verdict.map(|v| v.into()), summary, labels, &signer)?; + patch.review_edit( + review, + verdict.map(|v| v.into()), + summary.unwrap_or_default(), + labels, + embeds + .unwrap_or_default() + .into_iter() + .map(Into::into) + .collect::>(), + &signer, + )?; + } + models::patch::Action::ReviewReact { + review, + reaction, + active, + } => { + patch.review_react(review, reaction, active, &signer)?; } models::patch::Action::Review { revision, diff --git a/crates/test-http-api/Cargo.toml b/crates/test-http-api/Cargo.toml index b997c42ba..5b3654f68 100644 --- a/crates/test-http-api/Cargo.toml +++ b/crates/test-http-api/Cargo.toml @@ -10,7 +10,7 @@ anyhow = { version = "1.0.90" } axum = { version = "0.8.1", default-features = false, features = ["json", "query", "tokio", "http1"] } hyper = { version = "1.6", default-features = false } lexopt = { version = "0.3.0" } -radicle = { version = "0.15.0" } +radicle = { version = "0.16.1" } radicle-surf = { version = "0.22.1", default-features = false, features = ["serde"] } radicle-types = { path = "../radicle-types" } serde = { version = "1.0.0", features = ["derive"] }