mirror of https://github.com/LemmyNet/lemmy.git
Fixing couldnt find community error.
parent
cd0574d277
commit
9909e18bd2
|
@ -90,7 +90,7 @@ test('Create a post', async () => {
|
|||
|
||||
test('Create a post in a non-existent community', async () => {
|
||||
let postRes = await createPost(alpha, -2);
|
||||
expect(postRes).toStrictEqual({ error: 'couldnt_create_post' });
|
||||
expect(postRes).toStrictEqual({ error: 'couldnt_find_community' });
|
||||
});
|
||||
|
||||
test('Unlike a post', async () => {
|
||||
|
|
|
@ -361,7 +361,9 @@ pub async fn check_community_deleted_or_removed(
|
|||
community_id: CommunityId,
|
||||
pool: &DbPool,
|
||||
) -> Result<(), LemmyError> {
|
||||
let community = blocking(pool, move |conn| Community::read(conn, community_id)).await??;
|
||||
let community = blocking(pool, move |conn| Community::read(conn, community_id))
|
||||
.await?
|
||||
.map_err(|_| ApiError::err("couldnt_find_community"))?;
|
||||
if community.deleted || community.removed {
|
||||
Err(ApiError::err("deleted").into())
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue