diff --git a/Cargo.lock b/Cargo.lock index f61686291..a9d4b62bb 100644 --- a/Cargo.lock +++ b/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]] diff --git a/crates/radicle-tauri/src/commands/cob.rs b/crates/radicle-tauri/src/commands/cob.rs index 62cb74757..d925c6335 100644 --- a/crates/radicle-tauri/src/commands/cob.rs +++ b/crates/radicle-tauri/src/commands/cob.rs @@ -34,6 +34,19 @@ pub async fn get_file_by_oid( Ok::<_, error::Error>(STANDARD.encode(blob.content())) } +#[tauri::command] +pub async fn save_embed( + ctx: tauri::State<'_, AppState>, + rid: identity::RepoId, + name: &str, + bytes: &[u8], +) -> Result { + let repo = ctx.profile.storage.repository(rid)?; + let embed = cob::Embed::::store(name, bytes, &repo.backend)?; + + Ok::<_, error::Error>(embed.oid()) +} + #[tauri::command] pub fn activity_by_id( ctx: tauri::State, diff --git a/crates/radicle-tauri/src/commands/cob/issue.rs b/crates/radicle-tauri/src/commands/cob/issue.rs index e5fcd4374..34a73e818 100644 --- a/crates/radicle-tauri/src/commands/cob/issue.rs +++ b/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)?; diff --git a/crates/radicle-tauri/src/lib.rs b/crates/radicle-tauri/src/lib.rs index 403802436..277dc154c 100644 --- a/crates/radicle-tauri/src/lib.rs +++ b/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, diff --git a/crates/radicle-tauri/src/types/cobs.rs b/crates/radicle-tauri/src/types/cobs.rs index f4bc58087..ed0d4d66c 100644 --- a/crates/radicle-tauri/src/types/cobs.rs +++ b/crates/radicle-tauri/src/types/cobs.rs @@ -318,7 +318,7 @@ pub struct NewIssue { #[ts(as = "Vec")] pub assignees: Vec, #[ts(type = "{ name: string, content: string }[]")] - pub embeds: Vec, + pub embeds: Vec>, } #[derive(TS, Serialize, Deserialize)] diff --git a/crates/radicle-tauri/src/types/thread.rs b/crates/radicle-tauri/src/types/thread.rs index a4d477277..b2f4b3380 100644 --- a/crates/radicle-tauri/src/types/thread.rs +++ b/crates/radicle-tauri/src/types/thread.rs @@ -18,7 +18,7 @@ pub struct CreateReviewComment { pub reply_to: Option, pub location: Option, #[ts(type = "{ name: string, content: string }[]")] - pub embeds: Vec, + pub embeds: Vec>, } #[derive(Serialize, TS)] @@ -102,7 +102,7 @@ pub struct NewIssueComment { #[ts(optional)] pub reply_to: Option, #[ts(type = "{ name: string, content: string }[]")] - pub embeds: Vec, + pub embeds: Vec>, } #[derive(TS, Serialize, Deserialize)] @@ -119,7 +119,7 @@ pub struct NewPatchComment { pub reply_to: Option, pub location: Option, #[ts(type = "{ name: string, content: string }[]")] - pub embeds: Vec, + pub embeds: Vec>, } #[derive(TS, Serialize, Deserialize)]