From 4aa7f01da39ab55b4f6346e7565d8bb29566de39 Mon Sep 17 00:00:00 2001 From: Vika Date: Sun, 5 Dec 2021 23:00:01 +0300 Subject: Code cleanup and small bugfixing in templates --- src/micropub/post.rs | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'src/micropub') diff --git a/src/micropub/post.rs b/src/micropub/post.rs index def518a..070c822 100644 --- a/src/micropub/post.rs +++ b/src/micropub/post.rs @@ -133,17 +133,17 @@ pub fn normalize_mf2(mut body: serde_json::Value, user: &User) -> (String, serde let default_channel = me.join(DEFAULT_CHANNEL_PATH).unwrap().to_string(); body["properties"]["channel"] = json!([default_channel]); - }, + } Some("h-card") => { let default_channel = me.join(CONTACTS_CHANNEL_PATH).unwrap().to_string(); body["properties"]["channel"] = json!([default_channel]); - }, + } Some("h-food") => { let default_channel = me.join(FOOD_CHANNEL_PATH).unwrap().to_string(); body["properties"]["channel"] = json!([default_channel]); - }, + } // TODO h-event /*"h-event" => { let default_channel @@ -239,14 +239,7 @@ pub async fn new_post( Ok(exists) => { if exists { if let Err(err) = storage - .update_post( - &channel, - json!({ - "add": { - "children": [uid] - } - }), - ) + .update_post(&channel, json!({"add": {"children": [uid]}})) .await { return error_json!( @@ -258,7 +251,10 @@ pub async fn new_post( ) ); } - } else if channel == default_channel || channel == vcards_channel || channel == food_channel { + } else if channel == default_channel + || channel == vcards_channel + || channel == food_channel + { if let Err(err) = create_feed(storage, &uid, &channel, &user).await { return error_json!( 500, -- cgit 1.4.1