Radish alpha
r
rad:z4D5UCArafTzTQpDZNQRuqswh3ury
Radicle desktop app
Radicle
Git
Add embed fix and add `save_embed` command
Merged did:key:z6MkkfM3...sVz5 opened 1 year ago
6 files changed +32 -14 a3a0850b ebbccccc
modified Cargo.lock
@@ -3764,7 +3764,7 @@ dependencies = [
[[package]]
name = "radicle"
version = "0.13.0"
-
source = "git+https://seed.radicle.xyz/z3gqcJUoA1n9HaHKufZs5FCSGazv5.git#034eb418600f01ffc27b84ad399372410d49cd13"
+
source = "git+https://seed.radicle.xyz/z3gqcJUoA1n9HaHKufZs5FCSGazv5.git#855327d303566aac1d3e065d4ba7e16d9ccd18e6"
dependencies = [
 "amplify",
 "base64 0.21.7",
@@ -3794,7 +3794,7 @@ dependencies = [
[[package]]
name = "radicle-cob"
version = "0.12.0"
-
source = "git+https://seed.radicle.xyz/z3gqcJUoA1n9HaHKufZs5FCSGazv5.git#034eb418600f01ffc27b84ad399372410d49cd13"
+
source = "git+https://seed.radicle.xyz/z3gqcJUoA1n9HaHKufZs5FCSGazv5.git#855327d303566aac1d3e065d4ba7e16d9ccd18e6"
dependencies = [
 "fastrand",
 "git2",
@@ -3812,7 +3812,7 @@ dependencies = [
[[package]]
name = "radicle-crypto"
version = "0.11.0"
-
source = "git+https://seed.radicle.xyz/z3gqcJUoA1n9HaHKufZs5FCSGazv5.git#034eb418600f01ffc27b84ad399372410d49cd13"
+
source = "git+https://seed.radicle.xyz/z3gqcJUoA1n9HaHKufZs5FCSGazv5.git#855327d303566aac1d3e065d4ba7e16d9ccd18e6"
dependencies = [
 "amplify",
 "cyphernet",
@@ -3830,7 +3830,7 @@ dependencies = [
[[package]]
name = "radicle-dag"
version = "0.9.0"
-
source = "git+https://seed.radicle.xyz/z3gqcJUoA1n9HaHKufZs5FCSGazv5.git#034eb418600f01ffc27b84ad399372410d49cd13"
+
source = "git+https://seed.radicle.xyz/z3gqcJUoA1n9HaHKufZs5FCSGazv5.git#855327d303566aac1d3e065d4ba7e16d9ccd18e6"
dependencies = [
 "fastrand",
]
@@ -3852,7 +3852,7 @@ dependencies = [
[[package]]
name = "radicle-ssh"
version = "0.9.0"
-
source = "git+https://seed.radicle.xyz/z3gqcJUoA1n9HaHKufZs5FCSGazv5.git#034eb418600f01ffc27b84ad399372410d49cd13"
+
source = "git+https://seed.radicle.xyz/z3gqcJUoA1n9HaHKufZs5FCSGazv5.git#855327d303566aac1d3e065d4ba7e16d9ccd18e6"
dependencies = [
 "byteorder",
 "log",
@@ -6118,7 +6118,7 @@ version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
dependencies = [
-
 "windows-sys 0.59.0",
+
 "windows-sys 0.48.0",
]

[[package]]
modified crates/radicle-tauri/src/commands/cob.rs
@@ -35,6 +35,19 @@ pub async fn get_file_by_oid(
}

#[tauri::command]
+
pub async fn save_embed(
+
    ctx: tauri::State<'_, AppState>,
+
    rid: identity::RepoId,
+
    name: &str,
+
    bytes: &[u8],
+
) -> Result<git::Oid, error::Error> {
+
    let repo = ctx.profile.storage.repository(rid)?;
+
    let embed = cob::Embed::<git::Oid>::store(name, bytes, &repo.backend)?;
+

+
    Ok::<_, error::Error>(embed.oid())
+
}
+

+
#[tauri::command]
pub fn activity_by_id(
    ctx: tauri::State<AppState>,
    rid: identity::RepoId,
modified crates/radicle-tauri/src/commands/cob/issue.rs
@@ -73,11 +73,15 @@ pub fn edit_issue(
        cobs::IssueAction::CommentRedact { id } => {
            issue.redact_comment(id, &signer)?;
        }
-
        cobs::IssueAction::Comment { .. } => {
-
            unimplemented!("Create of issue comment not yet implemented")
+
        cobs::IssueAction::Comment {
+
            body,
+
            reply_to,
+
            embeds,
+
        } => {
+
            issue.comment(body, reply_to.unwrap_or(cob_id), embeds, &signer)?;
        }
-
        cobs::IssueAction::CommentEdit { .. } => {
-
            unimplemented!("Edit of issue comment not yet implemented")
+
        cobs::IssueAction::CommentEdit { id, body, embeds } => {
+
            issue.edit_comment(id, body, embeds, &signer)?;
        }
        cobs::IssueAction::Edit { title } => {
            issue.edit(title, &signer)?;
modified crates/radicle-tauri/src/lib.rs
@@ -78,6 +78,7 @@ pub fn run() {
            repo::diff_stats,
            cob::get_file_by_oid,
            cob::activity_by_id,
+
            cob::save_embed,
            cob::issue::list_issues,
            cob::issue::issue_by_id,
            cob::issue::create_issue,
modified crates/radicle-tauri/src/types/cobs.rs
@@ -318,7 +318,7 @@ pub struct NewIssue {
    #[ts(as = "Vec<String>")]
    pub assignees: Vec<identity::Did>,
    #[ts(type = "{ name: string, content: string }[]")]
-
    pub embeds: Vec<cob::Embed>,
+
    pub embeds: Vec<cob::Embed<cob::Uri>>,
}

#[derive(TS, Serialize, Deserialize)]
modified crates/radicle-tauri/src/types/thread.rs
@@ -18,7 +18,7 @@ pub struct CreateReviewComment {
    pub reply_to: Option<cob::thread::CommentId>,
    pub location: Option<thread::CodeLocation>,
    #[ts(type = "{ name: string, content: string }[]")]
-
    pub embeds: Vec<cob::Embed>,
+
    pub embeds: Vec<cob::Embed<cob::Uri>>,
}

#[derive(Serialize, TS)]
@@ -102,7 +102,7 @@ pub struct NewIssueComment {
    #[ts(optional)]
    pub reply_to: Option<cob::thread::CommentId>,
    #[ts(type = "{ name: string, content: string }[]")]
-
    pub embeds: Vec<cob::Embed>,
+
    pub embeds: Vec<cob::Embed<cob::Uri>>,
}

#[derive(TS, Serialize, Deserialize)]
@@ -119,7 +119,7 @@ pub struct NewPatchComment {
    pub reply_to: Option<cob::thread::CommentId>,
    pub location: Option<CodeLocation>,
    #[ts(type = "{ name: string, content: string }[]")]
-
    pub embeds: Vec<cob::Embed>,
+
    pub embeds: Vec<cob::Embed<cob::Uri>>,
}

#[derive(TS, Serialize, Deserialize)]