forgot some

This commit is contained in:
Felix Ableitner 2021-04-16 13:32:57 +02:00
parent 19001cf326
commit 08003d5e3b
2 changed files with 5 additions and 11 deletions

View File

@ -237,10 +237,9 @@ pub fn is_admin(local_user_view: &LocalUserView) -> Result<(), LemmyError> {
} }
pub async fn get_post(post_id: PostId, pool: &DbPool) -> Result<Post, LemmyError> { pub async fn get_post(post_id: PostId, pool: &DbPool) -> Result<Post, LemmyError> {
match blocking(pool, move |conn| Post::read(conn, post_id)).await? { blocking(pool, move |conn| Post::read(conn, post_id))
Ok(post) => Ok(post), .await?
Err(_e) => Err(ApiError::err("couldnt_find_post").into()), .map_err(|_| ApiError::err("couldnt_find_post").into())
}
} }
pub async fn get_local_user_view_from_jwt( pub async fn get_local_user_view_from_jwt(

View File

@ -111,16 +111,11 @@ impl PerformCrud for Register {
}; };
// insert the person // insert the person
let inserted_person = match blocking(context.pool(), move |conn| { let inserted_person = blocking(context.pool(), move |conn| {
Person::create(conn, &person_form) Person::create(conn, &person_form)
}) })
.await? .await?
{ .map_err(|_| ApiError::err("user_already_exists"))?;
Ok(u) => u,
Err(_) => {
return Err(ApiError::err("user_already_exists").into());
}
};
// Create the local user // Create the local user
let local_user_form = LocalUserForm { let local_user_form = LocalUserForm {