From f1f32d8574583e70f4d3f397af7685f3fd44984e Mon Sep 17 00:00:00 2001 From: Fintan Halpenny Date: Thu, 5 Oct 2023 18:33:15 +0100 Subject: [PATCH] radicle: return verified doc The `identity_doc_at` and `identity_doc` methods on `ReadRepository` returned the unverified identity document. Every usage of these methods would always verify the document after. Simplify the code by calling verified in the methods and directly return the verified identity document. Signed-off-by: Fintan Halpenny X-Clacks-Overhead: GNU Terry Pratchett --- radicle-httpd/src/api.rs | 1 + radicle-httpd/src/api/v1/projects.rs | 1 + radicle/src/storage/refs.rs | 2 ++ 3 files changed, 4 insertions(+) diff --git a/radicle-httpd/src/api.rs b/radicle-httpd/src/api.rs index 3694458a..719ecc75 100644 --- a/radicle-httpd/src/api.rs +++ b/radicle-httpd/src/api.rs @@ -55,6 +55,7 @@ impl Context { let repo = storage.repository(id)?; let (_, head) = repo.head()?; let DocAt { doc, .. } = repo.identity_doc()?; + let payload = doc.project()?; let delegates = doc.delegates; let issues = issue::Issues::open(&repo)?.counts()?; diff --git a/radicle-httpd/src/api/v1/projects.rs b/radicle-httpd/src/api/v1/projects.rs index 829408d7..ab453a24 100644 --- a/radicle-httpd/src/api/v1/projects.rs +++ b/radicle-httpd/src/api/v1/projects.rs @@ -90,6 +90,7 @@ async fn project_root_handler( let Ok(repo) = storage.repository(id) else { return None }; let Ok((_, head)) = repo.head() else { return None }; let Ok(DocAt { doc, .. }) = repo.identity_doc() else { return None }; + let Ok(payload) = doc.project() else { return None }; let Ok(issues) = issue::Issues::open(&repo) else { return None }; let Ok(issues) = issues.counts() else { return None }; diff --git a/radicle/src/storage/refs.rs b/radicle/src/storage/refs.rs index 7ce78cd0..a455da76 100644 --- a/radicle/src/storage/refs.rs +++ b/radicle/src/storage/refs.rs @@ -62,6 +62,8 @@ impl Error { } } +// TODO(finto): we should turn `git::RefString` to `git::Qualified`, +// since all these refs SHOULD be `Qualified`. /// The published state of a local repository. #[derive(Default, Clone, Debug, PartialEq, Eq, Serialize)] pub struct Refs(BTreeMap);