radicle/cob/thread: Make comments private

There is no strong reason to have `pub(crate)` here.
This commit is contained in:
Lorenz Leutgeb
2026-08-23 19:15:09 +02:00
parent a62b808773
commit 5ddd5c64ea
2 changed files with 6 additions and 2 deletions
+1 -1
View File
@@ -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 {
+5 -1
View File
@@ -289,7 +289,7 @@ impl From<Action> for nonempty::NonEmpty<Action> {
#[serde(rename_all = "camelCase")]
pub struct Thread<T = Comment> {
/// The comments under the thread.
pub(crate) comments: BTreeMap<CommentId, Option<T>>,
comments: BTreeMap<CommentId, Option<T>>,
/// Comment timeline.
pub(crate) timeline: Vec<CommentId>,
}
@@ -357,6 +357,10 @@ impl<T> Thread<T> {
pub fn timeline(&self) -> impl DoubleEndedIterator<Item = &EntryId> + '_ {
self.timeline.iter()
}
pub fn get_comment(&self, id: &CommentId) -> Option<&Option<T>> {
self.comments.get(id)
}
}
impl Thread {