Radish alpha
r
rad:z4D5UCArafTzTQpDZNQRuqswh3ury
Radicle desktop app
Radicle
Git
Update radicle crate
Sebastian Martinez committed 9 months ago
commit 7765b7d76571d0eda6f5d764b9fc374e0c98e8a1
parent 1b1e724
9 files changed +64 -47
modified 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",
modified 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"] }
modified 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"] }
modified crates/radicle-types/bindings/cob/patch/Action.ts
@@ -23,6 +23,7 @@ export type Action =
    summary?: string;
    verdict?: Verdict;
    labels?: Array<string>;
+
    embeds?: Array<Embed> | null;
  }
  | { "type": "review.redact"; review: string }
  | {
@@ -51,6 +52,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;
    base: string;
modified 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<Comment<CodeLocation>>;
  timestamp: number;
  labels: Array<string>;
deleted crates/radicle-types/bindings/cob/patch/ReviewEdit.ts
@@ -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<string>;
-
};
modified crates/radicle-types/src/domain/patch/models/patch.rs
@@ -115,23 +115,6 @@ impl From<patch::State> 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<Verdict>,
-
    #[serde(default, skip_serializing_if = "Option::is_none")]
-
    #[ts(optional)]
-
    pub summary: Option<String>,
-
    #[ts(as = "Option<Vec<String>>", optional)]
-
    pub labels: Vec<cob::Label>,
-
}
-

#[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<Verdict>,
-
    #[serde(default, skip_serializing_if = "Option::is_none")]
-
    #[ts(optional)]
-
    summary: Option<String>,
+
    summary: String,
    comments: Vec<cobs::thread::Comment<cobs::thread::CodeLocation>>,
    #[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::<Vec<_>>(),
            comments: review
                .comments()
@@ -370,6 +351,9 @@ pub enum Action {
        #[serde(default, skip_serializing_if = "Vec::is_empty")]
        #[ts(as = "Option<Vec<String>>", optional)]
        labels: Vec<cob::Label>,
+
        #[serde(default, skip_serializing_if = "Option::is_none")]
+
        #[ts(as = "Option<_>", optional)]
+
        embeds: Option<Vec<cobs::thread::Embed>>,
    },
    #[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<radicle::patch::Action> 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::<Vec<_>>()),
            },
        }
    }
modified 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.unwrap_or_default(),
+
                    labels,
+
                    embeds
+
                        .unwrap_or_default()
+
                        .into_iter()
+
                        .map(Into::into)
+
                        .collect::<Vec<_>>(),
+
                    &signer,
+
                )?;
+
            }
+
            models::patch::Action::ReviewReact {
+
                review,
+
                reaction,
+
                active,
            } => {
-
                patch.review_edit(review, verdict.map(|v| v.into()), summary, labels, &signer)?;
+
                patch.review_react(review, reaction, active, &signer)?;
            }
            models::patch::Action::Review {
                revision,
modified 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"] }