Reduce pub accessors in patch and issue cob structs

Replaces pub accessors to struct fields with methods
Also creates some methods to compute necessary information

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
This commit is contained in:
Sebastian Martinez
2023-03-31 13:44:37 +02:00
committed by Alexis Sellier
parent f7fc778c3b
commit fff45817bc
+6 -7
View File
@@ -121,15 +121,14 @@ pub(crate) fn patch(id: PatchId, patch: Patch, repo: &git::Repository) -> Value
json!({
"id": id,
"description": rev.description(),
"base": rev.base,
"oid": rev.oid,
"refs": get_refs(repo, patch.author().id(), &rev.oid).unwrap_or(vec![]),
"base": rev.base(),
"oid": rev.head(),
"refs": get_refs(repo, patch.author().id(), &rev.head()).unwrap_or(vec![]),
"merges": rev.merges().collect::<Vec<_>>(),
"discussions": rev.discussion
.comments()
.map(|(id, comment)| Comment::new(id, comment, &rev.discussion))
"discussions": rev.discussion().comments()
.map(|(id, comment)| Comment::new(id, comment, rev.discussion()))
.collect::<Vec<_>>(),
"timestamp": rev.timestamp,
"timestamp": rev.timestamp(),
"reviews": rev.reviews().collect::<Vec<_>>(),
})
}).collect::<Vec<_>>(),