mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-15 17:03:59 +00:00
Nutomic
6d7b38f4de
* Implement endpoints for user data import/export * add test * exclude avatar/banner * increase import url count, add rate limit * also export/import saved posts * rate limit * rename * saved posts also exist * rename routes * fix test * error handling * clippy * limit parallelism * clippy --------- Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
26 lines
818 B
Rust
26 lines
818 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;
|
|
pub mod user_settings_backup;
|
|
|
|
/// 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)
|
|
}
|