Return empty array in response to pinned statuses query
https://codeberg.org/silverpill/mitra/issues/6
This commit is contained in:
parent
9591be4df0
commit
b03b6e52aa
2 changed files with 23 additions and 4 deletions
|
@ -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<Uuid>,
|
||||
|
||||
#[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<i32>,
|
||||
|
||||
#[serde(default = "default_page_size")]
|
||||
#[serde(default = "default_follow_list_page_size")]
|
||||
pub limit: i64,
|
||||
}
|
||||
|
||||
|
|
|
@ -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<Config>,
|
||||
db_pool: web::Data<Pool>,
|
||||
web::Path(account_id): web::Path<Uuid>,
|
||||
query_params: web::Query<TimelineQueryParams>,
|
||||
query_params: web::Query<StatusListQueryParams>,
|
||||
) -> Result<HttpResponse, HttpError> {
|
||||
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<Status> = 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,
|
||||
|
|
Loading…
Reference in a new issue