add another async (and correctly convert followers_count)

This commit is contained in:
Mina Galić 2020-05-24 21:03:59 +02:00
parent cb1c260692
commit 0726375859
No known key found for this signature in database
GPG key ID: ACFEFF7F6A123A86
2 changed files with 5 additions and 2 deletions

View file

@ -401,7 +401,7 @@ pub fn valid_slug(title: &str) -> Result<(), ValidationError> {
}
#[post("/~/<blog_name>/new", data = "<form>")]
pub fn create(
pub async fn create(
blog_name: String,
form: LenientForm<NewPostForm>,
cl: ContentLen,

View file

@ -277,7 +277,10 @@ pub async fn followers(
let conn = &*rockets.conn;
let page = page.unwrap_or_default();
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(
&rockets.to_context(),