mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-12-02 01:01:20 +00:00
Nutomic
3578dab67f
* Remove PerformApub trait This is completely useless now that websocket is gone. In the future I also plan to remove Perform and PerformCrud traits, but it will be difficult to do that while still compiling crates in parallel. * params need to use query
25 lines
788 B
Rust
25 lines
788 B
Rust
use lemmy_db_schema::{newtypes::CommunityId, source::local_site::LocalSite, ListingType};
|
|
use lemmy_utils::error::LemmyError;
|
|
|
|
pub mod list_comments;
|
|
pub mod list_posts;
|
|
pub mod read_community;
|
|
pub mod read_person;
|
|
pub mod resolve_object;
|
|
pub mod search;
|
|
|
|
/// Returns default listing type, depending if the query is for frontpage or community.
|
|
fn listing_type_with_default(
|
|
type_: Option<ListingType>,
|
|
local_site: &LocalSite,
|
|
community_id: Option<CommunityId>,
|
|
) -> Result<ListingType, LemmyError> {
|
|
// On frontpage use listing type from param or admin configured default
|
|
let listing_type = if community_id.is_none() {
|
|
type_.unwrap_or(local_site.default_post_listing_type)
|
|
} else {
|
|
// inside of community show everything
|
|
ListingType::All
|
|
};
|
|
Ok(listing_type)
|
|
}
|