mirror of
https://seed.radicle.dev/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5.git
synced 2026-11-29 05:50:31 +08:00
radicle/cob/thread: Make comments private
There is no strong reason to have `pub(crate)` here.
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user