httpd: Use `repo.identity_doc()` instead of `repo.identity_of(..)`

Signed-off-by: xphoniex <dj.2dixx@gmail.com>
This commit is contained in:
xphoniex 2023-02-28 14:56:56 +00:00 committed by Alexis Sellier
parent 68aca5dd65
commit de24a04621
No known key found for this signature in database
4 changed files with 9 additions and 3 deletions

View File

@ -48,7 +48,7 @@ impl Context {
let storage = &self.profile.storage;
let repo = storage.repository(id)?;
let (_, head) = repo.head()?;
let doc = repo.identity_of(self.profile.id())?;
let doc = repo.identity_doc()?.1.verified()?;
let payload = doc.project()?;
let delegates = doc.delegates;
let issues = Issues::open(self.profile.public_key, &repo)?.counts()?;

View File

@ -61,6 +61,10 @@ pub enum Error {
/// Storage refs error.
#[error(transparent)]
StorageRef(#[from] radicle::storage::refs::Error),
/// Identity doc error.
#[error(transparent)]
IdentityDoc(#[from] radicle::identity::doc::DocError),
}
impl IntoResponse for Error {

View File

@ -40,7 +40,8 @@ async fn delegates_projects_handler(
.filter_map(|id| {
let Ok(repo) = storage.repository(id) else { return None };
let Ok((_, head)) = repo.head() else { return None };
let Ok(doc) = repo.identity_of(ctx.profile.id()) else { return None };
let Ok((_, doc)) = repo.identity_doc() else { return None };
let Ok(doc) = doc.verified() else { return None };
let Ok(payload) = doc.project() else { return None };
let delegates = doc.delegates;

View File

@ -79,7 +79,8 @@ async fn project_root_handler(
let Ok(repo) = storage.repository(id) else { return None };
let Ok((_, head)) = repo.head() else { return None };
let Ok(payload) = repo.project_of(ctx.profile.id()) else { return None };
let Ok(doc) = repo.identity_of(ctx.profile.id()) else { return None };
let Ok((_, doc)) = repo.identity_doc() else { return None };
let Ok(doc) = doc.verified() else { return None };
let Ok(issues) = Issues::open(ctx.profile.public_key, &repo) else { return None };
let Ok(issues) = issues.counts() else { return None };
let Ok(patches) = Patches::open(ctx.profile.public_key, &repo) else { return None };