From 5ddd5c64ea253b91562eb79a8bfa11d0a8b154c8 Mon Sep 17 00:00:00 2001 From: Lorenz Leutgeb Date: Mon, 17 Aug 2026 17:50:48 +0200 Subject: [PATCH] radicle/cob/thread: Make `comments` private There is no strong reason to have `pub(crate)` here. --- crates/radicle/src/cob/issue.rs | 2 +- crates/radicle/src/cob/thread.rs | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/radicle/src/cob/issue.rs b/crates/radicle/src/cob/issue.rs index 0fd572781..c31f349a1 100644 --- a/crates/radicle/src/cob/issue.rs +++ b/crates/radicle/src/cob/issue.rs @@ -373,7 +373,7 @@ impl Issue { Action::Comment { .. } => Authorization::Allow, // All roles can edit or redact their own comments. Action::CommentEdit { id, .. } | Action::CommentRedact { id, .. } => { - if let Some(comment) = self.thread.comments.get(id) { + if let Some(comment) = self.thread.get_comment(id) { if let Some(comment) = comment { Authorization::from(actor == comment.author()) } else { diff --git a/crates/radicle/src/cob/thread.rs b/crates/radicle/src/cob/thread.rs index e15dd1289..c7a692707 100644 --- a/crates/radicle/src/cob/thread.rs +++ b/crates/radicle/src/cob/thread.rs @@ -289,7 +289,7 @@ impl From for nonempty::NonEmpty { #[serde(rename_all = "camelCase")] pub struct Thread { /// The comments under the thread. - pub(crate) comments: BTreeMap>, + comments: BTreeMap>, /// Comment timeline. pub(crate) timeline: Vec, } @@ -357,6 +357,10 @@ impl Thread { pub fn timeline(&self) -> impl DoubleEndedIterator + '_ { self.timeline.iter() } + + pub fn get_comment(&self, id: &CommentId) -> Option<&Option> { + self.comments.get(id) + } } impl Thread {