radicle-types: Use new type for titles

A new wrapper for titles was introduced in `radicle`. Use it instead of
strings and also add a corresponding error variant.
This commit is contained in:
Lorenz Leutgeb
2026-03-21 18:54:42 +01:00
parent d8cde006e9
commit 8271a9ded0
5 changed files with 17 additions and 5 deletions
+3 -1
View File
@@ -230,7 +230,9 @@ impl FromRadicleAction<radicle::issue::Action> for Action {
radicle::issue::Action::Lifecycle { state } => Self::Lifecycle {
state: state.into(),
},
radicle::issue::Action::Edit { title } => Self::Edit { title },
radicle::issue::Action::Edit { title } => Self::Edit {
title: title.to_string(),
},
}
}
}
@@ -578,7 +578,10 @@ impl FromRadicleAction<radicle::patch::Action> for Action {
.map(|a| Author::new(a, aliases))
.collect::<BTreeSet<_>>(),
},
radicle::patch::Action::Edit { title, target } => Self::Edit { title, target },
radicle::patch::Action::Edit { title, target } => Self::Edit {
title: title.to_string(),
target,
},
radicle::patch::Action::Label { labels } => Self::Label { labels },
radicle::patch::Action::Lifecycle { state } => Self::Lifecycle { state },
radicle::patch::Action::Merge { revision, commit } => Self::Merge { revision, commit },
+4
View File
@@ -152,6 +152,10 @@ pub enum Error {
#[error(transparent)]
Issue(#[from] radicle::issue::Error),
/// Invalid title.
#[error(transparent)]
Title(#[from] radicle::cob::TitleError),
/// Node error.
#[error(transparent)]
Node(#[from] radicle::node::Error),
+4 -2
View File
@@ -1,5 +1,6 @@
use std::collections::BTreeSet;
use radicle::cob::Title;
use radicle::issue::cache::Issues as _;
use radicle::node::Handle;
use radicle::storage::ReadStorage;
@@ -106,8 +107,9 @@ pub trait IssuesMut: Profile {
let signer = profile.signer()?;
let aliases = profile.aliases();
let mut issues = profile.issues_mut(&repo)?;
let title = Title::try_from(new.title)?;
let issue = issues.create(
new.title,
title,
new.description,
&new.labels,
&new.assignees,
@@ -183,7 +185,7 @@ pub trait IssuesMut: Profile {
)?;
}
cobs::issue::Action::Edit { title } => {
issue.edit(title, &signer)?;
issue.edit(Title::try_from(title)?, &signer)?;
}
}
+2 -1
View File
@@ -1,5 +1,6 @@
use std::collections::BTreeSet;
use radicle::cob::Title;
use radicle::node::device::BoxedSigner;
use radicle::node::Handle;
use radicle::patch::cache::Patches as _;
@@ -140,7 +141,7 @@ pub trait PatchesMut: Profile {
patch.unresolve_review_comment(review, comment, &signer)?;
}
models::patch::Action::Edit { title, target } => {
patch.edit::<BoxedSigner, String>(title, target, &signer)?;
patch.edit::<BoxedSigner, String>(Title::try_from(title)?, target, &signer)?;
}
models::patch::Action::ReviewEdit {
review,