mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-26 22:31:20 +00:00
Adding site checking.
This commit is contained in:
parent
dd93ac49a3
commit
3fbc8b130d
1 changed files with 3 additions and 4 deletions
|
@ -142,10 +142,9 @@ impl Perform for CreateSite {
|
|||
) -> Result<SiteResponse, LemmyError> {
|
||||
let data: &CreateSite = &self;
|
||||
|
||||
match blocking(context.pool(), move |conn| { Site::read(conn, 1)}).await?
|
||||
{
|
||||
Ok(_site) => return Err(APIError::err("site_already_exists").into()),
|
||||
Err(_e) => (),
|
||||
let read_site = move |conn: &'_ _| Site::read(conn, 1);
|
||||
if blocking(context.pool(), read_site).await?.is_ok() {
|
||||
return Err(APIError::err("site_already_exists").into());
|
||||
};
|
||||
|
||||
let user = get_user_from_jwt(&data.auth, context.pool()).await?;
|
||||
|
|
Loading…
Reference in a new issue