diff options
Diffstat (limited to 'src/micropub')
-rw-r--r-- | src/micropub/get.rs | 4 | ||||
-rw-r--r-- | src/micropub/post.rs | 15 |
2 files changed, 10 insertions, 9 deletions
diff --git a/src/micropub/get.rs b/src/micropub/get.rs index 9732281..718714a 100644 --- a/src/micropub/get.rs +++ b/src/micropub/get.rs @@ -24,7 +24,7 @@ where match &*query.q { "config" => { let channels: Vec<MicropubChannel>; - match backend.get_channels(&user.me.as_str()).await { + match backend.get_channels(user.me.as_str()).await { Ok(chans) => channels = chans, Err(err) => return Ok(err.into()) } @@ -36,7 +36,7 @@ where }, "channel" => { let channels: Vec<MicropubChannel>; - match backend.get_channels(&user.me.as_str()).await { + match backend.get_channels(user.me.as_str()).await { Ok(chans) => channels = chans, Err(err) => return Ok(err.into()) } diff --git a/src/micropub/post.rs b/src/micropub/post.rs index c465a6f..de2b162 100644 --- a/src/micropub/post.rs +++ b/src/micropub/post.rs @@ -255,7 +255,7 @@ pub async fn new_post<S: Storage>( || channel == vcards_channel || channel == food_channel { - if let Err(err) = create_feed(storage, &uid, &channel, &user).await { + if let Err(err) = create_feed(storage, &uid, &channel, user).await { return error_json!( 500, "database_error", @@ -313,7 +313,7 @@ async fn create_feed( }, "children": [uid] }), - &user, + user, ); storage.put_post(&feed, user.me.as_str()).await } @@ -483,8 +483,9 @@ async fn post_process_new_post<S: Storage>( // TODO: Replace this function once the MF2 parser is ready // A compliant parser's output format includes rels, // we could just find a Webmention one in there - let pattern = easy_scraper::Pattern::new(r#"<link href="{{url}}" rel="webmention">"#) - .expect("Pattern for webmentions couldn't be parsed"); + let pattern = + easy_scraper::Pattern::new(r#"<link href="{{url}}" rel="webmention">"#) + .expect("Pattern for webmentions couldn't be parsed"); let matches = pattern.matches(&body); if matches.is_empty() { return None; @@ -580,7 +581,7 @@ async fn process_json<S: Storage>( "You're not allowed to delete someone else's posts." ); } - if let Err(error) = req.state().storage.delete_post(&url).await { + if let Err(error) = req.state().storage.delete_post(url).await { return Ok(error.into()); } Ok(Response::builder(200).build()) @@ -602,7 +603,7 @@ async fn process_json<S: Storage>( "You're not allowed to delete someone else's posts." ); } - if let Err(error) = req.state().storage.update_post(&url, body.clone()).await { + if let Err(error) = req.state().storage.update_post(url, body.clone()).await { Ok(error.into()) } else { Ok(Response::builder(204).build()) @@ -679,7 +680,7 @@ async fn process_form<S: Storage>( "You're not allowed to delete someone else's posts." ); } - if let Err(error) = req.state().storage.delete_post(&url).await { + if let Err(error) = req.state().storage.delete_post(url).await { return error_json!(500, "database_error", error); } return Ok(Response::builder(200).build()); |