* Fix remote community posts appearing in local listing (fixes #4180) * fmt * fix typo
This commit is contained in:
parent
375e232217
commit
e58a167d64
2 changed files with 12 additions and 2 deletions
|
@ -290,6 +290,7 @@ export async function searchPostLocal(
|
||||||
q: post.name,
|
q: post.name,
|
||||||
type_: "Posts",
|
type_: "Posts",
|
||||||
sort: "TopAll",
|
sort: "TopAll",
|
||||||
|
listing_type: "All",
|
||||||
};
|
};
|
||||||
return api.search(form);
|
return api.search(form);
|
||||||
}
|
}
|
||||||
|
|
|
@ -344,7 +344,7 @@ fn queries<'a>() -> Queries<
|
||||||
query = query.filter(post_aggregates::creator_id.eq(creator_id));
|
query = query.filter(post_aggregates::creator_id.eq(creator_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
if let (Some(listing_type), Some(person_id)) = (options.listing_type, person_id) {
|
if let Some(person_id) = person_id {
|
||||||
let is_subscribed = exists(
|
let is_subscribed = exists(
|
||||||
community_follower::table.filter(
|
community_follower::table.filter(
|
||||||
post_aggregates::community_id
|
post_aggregates::community_id
|
||||||
|
@ -352,7 +352,7 @@ fn queries<'a>() -> Queries<
|
||||||
.and(community_follower::person_id.eq(person_id)),
|
.and(community_follower::person_id.eq(person_id)),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
match listing_type {
|
match options.listing_type.unwrap_or_default() {
|
||||||
ListingType::Subscribed => query = query.filter(is_subscribed),
|
ListingType::Subscribed => query = query.filter(is_subscribed),
|
||||||
ListingType::Local => {
|
ListingType::Local => {
|
||||||
query = query
|
query = query
|
||||||
|
@ -370,6 +370,15 @@ fn queries<'a>() -> Queries<
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
match options.listing_type.unwrap_or_default() {
|
||||||
|
ListingType::Local => {
|
||||||
|
query = query
|
||||||
|
.filter(community::local.eq(true))
|
||||||
|
.filter(community::hidden.eq(false));
|
||||||
|
}
|
||||||
|
_ => query = query.filter(community::hidden.eq(false)),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(url_search) = &options.url_search {
|
if let Some(url_search) = &options.url_search {
|
||||||
|
|
Loading…
Reference in a new issue