add another async (and correctly convert followers_count)
This commit is contained in:
parent
cb1c260692
commit
0726375859
@ -401,7 +401,7 @@ pub fn valid_slug(title: &str) -> Result<(), ValidationError> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[post("/~/<blog_name>/new", data = "<form>")]
|
#[post("/~/<blog_name>/new", data = "<form>")]
|
||||||
pub fn create(
|
pub async fn create(
|
||||||
blog_name: String,
|
blog_name: String,
|
||||||
form: LenientForm<NewPostForm>,
|
form: LenientForm<NewPostForm>,
|
||||||
cl: ContentLen,
|
cl: ContentLen,
|
||||||
|
@ -277,7 +277,10 @@ pub async fn followers(
|
|||||||
let conn = &*rockets.conn;
|
let conn = &*rockets.conn;
|
||||||
let page = page.unwrap_or_default();
|
let page = page.unwrap_or_default();
|
||||||
let user: User = User::find_by_fqn(&rockets, &name).await?;
|
let user: User = User::find_by_fqn(&rockets, &name).await?;
|
||||||
let followers_count = user.count_followers(&conn);
|
let followers_count = match user.count_followers(&conn) {
|
||||||
|
Ok(num) => num,
|
||||||
|
Err(_) => 0,
|
||||||
|
};
|
||||||
|
|
||||||
Ok(render!(users::followers(
|
Ok(render!(users::followers(
|
||||||
&rockets.to_context(),
|
&rockets.to_context(),
|
||||||
|
Loading…
Reference in New Issue
Block a user