From fff45817bcd9c1b3cc3d8f0cc00ca963e678b98f Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Thu, 30 Mar 2023 17:45:00 +0200 Subject: [PATCH] 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 --- radicle-httpd/src/api/json.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/radicle-httpd/src/api/json.rs b/radicle-httpd/src/api/json.rs index 91482622f..996db6ca7 100644 --- a/radicle-httpd/src/api/json.rs +++ b/radicle-httpd/src/api/json.rs @@ -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::>(), - "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::>(), - "timestamp": rev.timestamp, + "timestamp": rev.timestamp(), "reviews": rev.reviews().collect::>(), }) }).collect::>(),