mirror of
https://github.com/LemmyNet/lemmy.git
synced 2025-02-02 15:21:40 +00:00
Adding listing_type.ModeratorView for list communities. (#5377)
- Fixes #5352
This commit is contained in:
parent
182f2532dc
commit
8f73c10e01
1 changed files with 9 additions and 4 deletions
|
@ -137,13 +137,18 @@ fn queries<'a>() -> Queries<
|
|||
NameDesc => query = query.order_by(lower(community::name).desc()),
|
||||
};
|
||||
|
||||
let is_subscribed = community_actions::follow_state.eq(Some(CommunityFollowerState::Accepted));
|
||||
|
||||
if let Some(listing_type) = o.listing_type {
|
||||
query = match listing_type {
|
||||
ListingType::Subscribed => {
|
||||
query.filter(community_actions::follow_state.eq(Some(CommunityFollowerState::Accepted)))
|
||||
ListingType::All => query.filter(community::hidden.eq(false).or(is_subscribed)),
|
||||
ListingType::Subscribed => query.filter(is_subscribed),
|
||||
ListingType::Local => query
|
||||
.filter(community::local.eq(true))
|
||||
.filter(community::hidden.eq(false).or(is_subscribed)),
|
||||
ListingType::ModeratorView => {
|
||||
query.filter(community_actions::became_moderator.is_not_null())
|
||||
}
|
||||
ListingType::Local => query.filter(community::local.eq(true)),
|
||||
_ => query,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue