mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-22 12:21:18 +00:00
forgot some
This commit is contained in:
parent
19001cf326
commit
08003d5e3b
2 changed files with 5 additions and 11 deletions
|
@ -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> {
|
||||
match blocking(pool, move |conn| Post::read(conn, post_id)).await? {
|
||||
Ok(post) => Ok(post),
|
||||
Err(_e) => Err(ApiError::err("couldnt_find_post").into()),
|
||||
}
|
||||
blocking(pool, move |conn| Post::read(conn, post_id))
|
||||
.await?
|
||||
.map_err(|_| ApiError::err("couldnt_find_post").into())
|
||||
}
|
||||
|
||||
pub async fn get_local_user_view_from_jwt(
|
||||
|
|
|
@ -111,16 +111,11 @@ impl PerformCrud for Register {
|
|||
};
|
||||
|
||||
// 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)
|
||||
})
|
||||
.await?
|
||||
{
|
||||
Ok(u) => u,
|
||||
Err(_) => {
|
||||
return Err(ApiError::err("user_already_exists").into());
|
||||
}
|
||||
};
|
||||
.map_err(|_| ApiError::err("user_already_exists"))?;
|
||||
|
||||
// Create the local user
|
||||
let local_user_form = LocalUserForm {
|
||||
|
|
Loading…
Reference in a new issue