From fa6e3fef17de18f80b5148b443d5f79f35d2dde2 Mon Sep 17 00:00:00 2001 From: Vika Date: Wed, 9 Apr 2025 23:06:25 +0300 Subject: Replace tuple from `normalize_mf2` with `NormalizedPost` struct This is a little bit more idiomatic. Perhaps I should consider doing the same with other tuples I return? Change-Id: I85f0e5dc76b8212ab6d192376d8c38ce2048ae85 --- src/frontend/onboarding.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/frontend') diff --git a/src/frontend/onboarding.rs b/src/frontend/onboarding.rs index 4588157..bf313cf 100644 --- a/src/frontend/onboarding.rs +++ b/src/frontend/onboarding.rs @@ -84,7 +84,7 @@ async fn onboard( .await .map_err(FrontendError::from)?; - let (_, hcard) = { + let crate::micropub::util::NormalizedPost { id: _, post: hcard } = { let mut hcard = data.user; hcard["properties"]["uid"] = serde_json::json!([&user_uid]); crate::micropub::normalize_mf2(hcard, &user) @@ -99,7 +99,7 @@ async fn onboard( continue; }; debug!("Creating feed {} with slug {}", &feed.name, &feed.slug); - let (_, feed) = crate::micropub::normalize_mf2( + let crate::micropub::util::NormalizedPost { id: _, post: feed } = crate::micropub::normalize_mf2( serde_json::json!({ "type": ["h-feed"], "properties": {"name": [feed.name], "mp-slug": [feed.slug]} @@ -111,7 +111,7 @@ async fn onboard( .await .map_err(FrontendError::from)?; } - let (uid, post) = crate::micropub::normalize_mf2(data.first_post, &user); + let crate::micropub::util::NormalizedPost { id: uid, post } = crate::micropub::normalize_mf2(data.first_post, &user); tracing::debug!("Posting first post {}...", uid); crate::micropub::_post(&user, uid, post, db, http, jobset) .await -- cgit 1.4.1