mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-12 15:34:00 +00:00
fix(posts/comments/search): return error on invalid community name (#3418)
This commit is contained in:
parent
cdc5b47886
commit
85dab149a9
3 changed files with 7 additions and 10 deletions
|
@ -27,9 +27,7 @@ pub async fn list_comments(
|
||||||
check_private_instance(&local_user_view, &local_site)?;
|
check_private_instance(&local_user_view, &local_site)?;
|
||||||
|
|
||||||
let community_id = if let Some(name) = &data.community_name {
|
let community_id = if let Some(name) = &data.community_name {
|
||||||
resolve_actor_identifier::<ApubCommunity, Community>(name, &context, &None, true)
|
Some(resolve_actor_identifier::<ApubCommunity, Community>(name, &context, &None, true).await?)
|
||||||
.await
|
|
||||||
.ok()
|
|
||||||
.map(|c| c.id)
|
.map(|c| c.id)
|
||||||
} else {
|
} else {
|
||||||
data.community_id
|
data.community_id
|
||||||
|
|
|
@ -29,9 +29,7 @@ pub async fn list_posts(
|
||||||
let page = data.page;
|
let page = data.page;
|
||||||
let limit = data.limit;
|
let limit = data.limit;
|
||||||
let community_id = if let Some(name) = &data.community_name {
|
let community_id = if let Some(name) = &data.community_name {
|
||||||
resolve_actor_identifier::<ApubCommunity, Community>(name, &context, &None, true)
|
Some(resolve_actor_identifier::<ApubCommunity, Community>(name, &context, &None, true).await?)
|
||||||
.await
|
|
||||||
.ok()
|
|
||||||
.map(|c| c.id)
|
.map(|c| c.id)
|
||||||
} else {
|
} else {
|
||||||
data.community_id
|
data.community_id
|
||||||
|
|
|
@ -41,10 +41,11 @@ pub async fn search(
|
||||||
let listing_type = data.listing_type;
|
let listing_type = data.listing_type;
|
||||||
let search_type = data.type_.unwrap_or(SearchType::All);
|
let search_type = data.type_.unwrap_or(SearchType::All);
|
||||||
let community_id = if let Some(name) = &data.community_name {
|
let community_id = if let Some(name) = &data.community_name {
|
||||||
resolve_actor_identifier::<ApubCommunity, Community>(name, &context, &local_user_view, false)
|
Some(
|
||||||
.await
|
resolve_actor_identifier::<ApubCommunity, Community>(name, &context, &local_user_view, false)
|
||||||
.ok()
|
.await?,
|
||||||
.map(|c| c.id)
|
)
|
||||||
|
.map(|c| c.id)
|
||||||
} else {
|
} else {
|
||||||
data.community_id
|
data.community_id
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue