mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-11-23 03:51:00 +00:00
Run cargo fmt
This commit is contained in:
parent
3fd89e6b48
commit
26ffde726f
9 changed files with 55 additions and 32 deletions
|
@ -314,8 +314,7 @@ fn get_proxy_config() -> Option<ProxyConfig> {
|
|||
}
|
||||
})
|
||||
} else {
|
||||
reqwest::Proxy::all(proxy_url)
|
||||
.expect("Invalid PROXY_URL")
|
||||
reqwest::Proxy::all(proxy_url).expect("Invalid PROXY_URL")
|
||||
};
|
||||
Some(ProxyConfig {
|
||||
url,
|
||||
|
|
|
@ -287,15 +287,15 @@ impl Post {
|
|||
|
||||
pub fn get_receivers_urls(&self, conn: &Connection) -> Result<Vec<String>> {
|
||||
Ok(self
|
||||
.get_authors(conn)?
|
||||
.into_iter()
|
||||
.filter_map(|a| a.get_followers(conn).ok())
|
||||
.fold(vec![], |mut acc, f| {
|
||||
for x in f {
|
||||
acc.push(x.ap_url);
|
||||
}
|
||||
acc
|
||||
}))
|
||||
.get_authors(conn)?
|
||||
.into_iter()
|
||||
.filter_map(|a| a.get_followers(conn).ok())
|
||||
.fold(vec![], |mut acc, f| {
|
||||
for x in f {
|
||||
acc.push(x.ap_url);
|
||||
}
|
||||
acc
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn to_activity(&self, conn: &Connection) -> Result<LicensedArticle> {
|
||||
|
|
|
@ -91,9 +91,11 @@ pub fn create(
|
|||
});
|
||||
|
||||
Flash::success(
|
||||
Redirect::to(
|
||||
uri!(super::posts::details: blog = blog_name, slug = slug, responding_to = _),
|
||||
),
|
||||
Redirect::to(uri!(
|
||||
super::posts::details: blog = blog_name,
|
||||
slug = slug,
|
||||
responding_to = _
|
||||
)),
|
||||
i18n!(&rockets.intl.catalog, "Your comment has been posted."),
|
||||
)
|
||||
})
|
||||
|
@ -168,7 +170,11 @@ pub fn delete(
|
|||
}
|
||||
}
|
||||
Ok(Flash::success(
|
||||
Redirect::to(uri!(super::posts::details: blog = blog, slug = slug, responding_to = _)),
|
||||
Redirect::to(uri!(
|
||||
super::posts::details: blog = blog,
|
||||
slug = slug,
|
||||
responding_to = _
|
||||
)),
|
||||
i18n!(&rockets.intl.catalog, "Your comment has been deleted."),
|
||||
))
|
||||
}
|
||||
|
|
|
@ -408,9 +408,14 @@ pub fn interact(rockets: PlumeRocket, user: Option<User>, target: String) -> Opt
|
|||
}
|
||||
|
||||
if let Ok(post) = Post::from_id(&rockets, &target, None, CONFIG.proxy()) {
|
||||
return Some(Redirect::to(
|
||||
uri!(super::posts::details: blog = post.get_blog(&rockets.conn).expect("Can't retrieve blog").fqn, slug = &post.slug, responding_to = _),
|
||||
));
|
||||
return Some(Redirect::to(uri!(
|
||||
super::posts::details: blog = post
|
||||
.get_blog(&rockets.conn)
|
||||
.expect("Can't retrieve blog")
|
||||
.fqn,
|
||||
slug = &post.slug,
|
||||
responding_to = _
|
||||
)));
|
||||
}
|
||||
|
||||
if let Ok(comment) = Comment::from_id(&rockets, &target, None, CONFIG.proxy()) {
|
||||
|
|
|
@ -45,9 +45,11 @@ pub fn create(
|
|||
.execute(move || broadcast(&user, delete_act, dest, CONFIG.proxy().cloned()));
|
||||
}
|
||||
|
||||
Ok(Redirect::to(
|
||||
uri!(super::posts::details: blog = blog, slug = slug, responding_to = _),
|
||||
))
|
||||
Ok(Redirect::to(uri!(
|
||||
super::posts::details: blog = blog,
|
||||
slug = slug,
|
||||
responding_to = _
|
||||
)))
|
||||
}
|
||||
|
||||
#[post("/~/<blog>/<slug>/like", rank = 2)]
|
||||
|
|
|
@ -356,7 +356,11 @@ pub fn update(
|
|||
}
|
||||
|
||||
Flash::success(
|
||||
Redirect::to(uri!(details: blog = blog, slug = new_slug, responding_to = _)),
|
||||
Redirect::to(uri!(
|
||||
details: blog = blog,
|
||||
slug = new_slug,
|
||||
responding_to = _
|
||||
)),
|
||||
i18n!(intl, "Your article has been updated."),
|
||||
)
|
||||
.into()
|
||||
|
@ -543,7 +547,11 @@ pub fn create(
|
|||
}
|
||||
|
||||
Ok(Flash::success(
|
||||
Redirect::to(uri!(details: blog = blog_name, slug = slug, responding_to = _)),
|
||||
Redirect::to(uri!(
|
||||
details: blog = blog_name,
|
||||
slug = slug,
|
||||
responding_to = _
|
||||
)),
|
||||
i18n!(&rockets.intl.catalog, "Your article has been saved."),
|
||||
)
|
||||
.into())
|
||||
|
@ -583,7 +591,11 @@ pub fn delete(
|
|||
.any(|a| a.id == user.id)
|
||||
{
|
||||
return Ok(Flash::error(
|
||||
Redirect::to(uri!(details: blog = blog_name, slug = slug, responding_to = _)),
|
||||
Redirect::to(uri!(
|
||||
details: blog = blog_name,
|
||||
slug = slug,
|
||||
responding_to = _
|
||||
)),
|
||||
i18n!(intl.catalog, "You are not allowed to delete this article."),
|
||||
));
|
||||
}
|
||||
|
|
|
@ -45,9 +45,11 @@ pub fn create(
|
|||
.execute(move || broadcast(&user, delete_act, dest, CONFIG.proxy().cloned()));
|
||||
}
|
||||
|
||||
Ok(Redirect::to(
|
||||
uri!(super::posts::details: blog = blog, slug = slug, responding_to = _),
|
||||
))
|
||||
Ok(Redirect::to(uri!(
|
||||
super::posts::details: blog = blog,
|
||||
slug = slug,
|
||||
responding_to = _
|
||||
)))
|
||||
}
|
||||
|
||||
#[post("/~/<blog>/<slug>/reshare", rank = 1)]
|
||||
|
|
|
@ -55,8 +55,7 @@ pub fn search(query: Option<Form<SearchQuery>>, rockets: PlumeRocket) -> Ructe {
|
|||
let query = query.map(Form::into_inner).unwrap_or_default();
|
||||
let page = query.page.unwrap_or_default();
|
||||
let mut parsed_query =
|
||||
Query::from_str(&query.q.as_deref().unwrap_or_default())
|
||||
.unwrap_or_default();
|
||||
Query::from_str(&query.q.as_deref().unwrap_or_default()).unwrap_or_default();
|
||||
|
||||
param_to_query!(query, parsed_query; normal: title, subtitle, content, tag,
|
||||
instance, author, blog, lang, license;
|
||||
|
|
|
@ -210,9 +210,7 @@ pub fn password_reset(
|
|||
.map_err(|err| password_reset_error_response(err, &rockets))?;
|
||||
|
||||
Ok(Flash::success(
|
||||
Redirect::to(uri!(
|
||||
new: m = _
|
||||
)),
|
||||
Redirect::to(uri!(new: m = _)),
|
||||
i18n!(
|
||||
rockets.intl.catalog,
|
||||
"Your password was successfully reset."
|
||||
|
|
Loading…
Reference in a new issue