Add embed fix and add save_embed command

This commit is contained in:
Sebastian Martinez
2024-10-14 13:47:41 +02:00
parent a3a0850b49
commit ebbccccc9d
6 changed files with 32 additions and 14 deletions
Generated
+6 -6
View File
@@ -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]]
+13
View File
@@ -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<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>,
@@ -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)?;
+1
View File
@@ -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,
+1 -1
View File
@@ -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)]
+3 -3
View File
@@ -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)]