diff --git a/src/mastodon_api/accounts/types.rs b/src/mastodon_api/accounts/types.rs index e154330..b62eb99 100644 --- a/src/mastodon_api/accounts/types.rs +++ b/src/mastodon_api/accounts/types.rs @@ -199,13 +199,27 @@ impl AccountUpdateData { } } -fn default_page_size() -> i64 { 40 } +fn default_page_size() -> i64 { 20 } + +#[derive(Deserialize)] +pub struct StatusListQueryParams { + #[serde(default)] + pub pinned: bool, + + pub max_id: Option, + + #[serde(default = "default_page_size")] + pub limit: i64, +} + + +fn default_follow_list_page_size() -> i64 { 40 } #[derive(Deserialize)] pub struct FollowListQueryParams { pub max_id: Option, - #[serde(default = "default_page_size")] + #[serde(default = "default_follow_list_page_size")] pub limit: i64, } diff --git a/src/mastodon_api/accounts/views.rs b/src/mastodon_api/accounts/views.rs index 28edf97..e85d803 100644 --- a/src/mastodon_api/accounts/views.rs +++ b/src/mastodon_api/accounts/views.rs @@ -21,7 +21,6 @@ use crate::models::posts::helpers::{ get_reposted_posts, }; use crate::mastodon_api::statuses::types::Status; -use crate::mastodon_api::timelines::types::TimelineQueryParams; use crate::models::posts::queries::get_posts_by_author; use crate::models::profiles::queries::{ get_profile_by_id, @@ -52,6 +51,7 @@ use super::types::{ AccountCreateData, AccountUpdateData, FollowListQueryParams, + StatusListQueryParams, }; #[post("")] @@ -311,13 +311,18 @@ async fn get_account_statuses( config: web::Data, db_pool: web::Data, web::Path(account_id): web::Path, - query_params: web::Query, + query_params: web::Query, ) -> Result { let db_client = &**get_database_client(&db_pool).await?; let maybe_current_user = match auth { Some(auth) => Some(get_current_user(db_client, auth.token()).await?), None => None, }; + if query_params.pinned { + // Pinned posts are not supported + let statuses: Vec = vec![]; + return Ok(HttpResponse::Ok().json(statuses)); + }; let profile = get_profile_by_id(db_client, &account_id).await?; let mut posts = get_posts_by_author( db_client,