about summary refs log tree commit diff
path: root/src/micropub/post.rs
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2021-12-05 23:00:01 +0300
committerVika <vika@fireburn.ru>2021-12-05 23:00:01 +0300
commit4aa7f01da39ab55b4f6346e7565d8bb29566de39 (patch)
tree125c147e1a39dfebc4be1a3ac3a6dd8fadb3855e /src/micropub/post.rs
parentc0b552318cb08872c7deae82a10122b0e16b7ae8 (diff)
downloadkittybox-4aa7f01da39ab55b4f6346e7565d8bb29566de39.tar.zst
Code cleanup and small bugfixing in templates
Diffstat (limited to 'src/micropub/post.rs')
-rw-r--r--src/micropub/post.rs20
1 files changed, 8 insertions, 12 deletions
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<S: Storage>(
             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<S: Storage>(
                             )
                         );
                     }
-                } 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,