- check_private_instance(&local_user_view, &local_site)?;
-
- let person_id = local_user_view.to_owned().map(|l| l.person.id);
-
- let sort = data.sort;
- let listing_type = data.type_;
- let page = data.page;
- let limit = data.limit;
- let local_user = local_user_view.map(|l| l.local_user);
- let mut communities = blocking(context.pool(), move |conn| {
- CommunityQuery::builder()
- .conn(conn)
- .listing_type(listing_type)
- .sort(sort)
- .local_user(local_user.as_ref())
- .page(page)
- .limit(limit)
- .build()
- .list()
- })
- .await??;
-
- // Blank out deleted or removed info for non-logged in users
- if person_id.is_none() {
- for cv in communities
- .iter_mut()
- .filter(|cv| cv.community.deleted || cv.community.removed)
- {
- cv.community = cv.to_owned().community.blank_out_deleted_or_removed_info();
- }
- }
-
- // Return the jwt
- Ok(ListCommunitiesResponse { communities })
+ let sort = data.sort;
+ let listing_type = data.type_;
+ let show_nsfw = data.show_nsfw;
+ let page = data.page;
+ let limit = data.limit;
+ let local_user = local_user_view.map(|l| l.local_user);
+ let communities = CommunityQuery {
+ listing_type,
+ show_nsfw,
+ sort,
+ local_user: local_user.as_ref(),
+ page,
+ limit,
+ is_mod_or_admin: is_admin,
+ ..Default::default()