Remove VoteView.item_id, SiteResponse.taglines (#5705)

* Add comment for VoteView field

* ci

* Remove deprecated field

* Remove VoteView.item_id
This commit is contained in:
Nutomic 2025-05-27 15:25:46 +00:00 committed by GitHub
parent 87cbc2f370
commit 35af960f42
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 4 additions and 19 deletions

View file

@ -339,8 +339,6 @@ pub struct EditSite {
/// The response for a site. /// The response for a site.
pub struct SiteResponse { pub struct SiteResponse {
pub site_view: SiteView, pub site_view: SiteView,
/// deprecated, use field `tagline` or /api/v4/tagline/list
pub taglines: Vec<()>,
} }
#[skip_serializing_none] #[skip_serializing_none]

View file

@ -134,10 +134,7 @@ pub async fn create_site(
local_site_rate_limit_to_rate_limit_config(&site_view.local_site_rate_limit); local_site_rate_limit_to_rate_limit_config(&site_view.local_site_rate_limit);
context.rate_limit_cell().set_config(rate_limit_config); context.rate_limit_cell().set_config(rate_limit_config);
Ok(Json(SiteResponse { Ok(Json(SiteResponse { site_view }))
site_view,
taglines: vec![],
}))
} }
fn validate_create_payload(local_site: &LocalSite, create_site: &CreateSite) -> LemmyResult<()> { fn validate_create_payload(local_site: &LocalSite, create_site: &CreateSite) -> LemmyResult<()> {

View file

@ -178,10 +178,7 @@ pub async fn update_site(
local_site_rate_limit_to_rate_limit_config(&site_view.local_site_rate_limit); local_site_rate_limit_to_rate_limit_config(&site_view.local_site_rate_limit);
context.rate_limit_cell().set_config(rate_limit_config); context.rate_limit_cell().set_config(rate_limit_config);
Ok(Json(SiteResponse { Ok(Json(SiteResponse { site_view }))
site_view,
taglines: vec![],
}))
} }
fn validate_update_payload(local_site: &LocalSite, edit_site: &EditSite) -> LemmyResult<()> { fn validate_update_payload(local_site: &LocalSite, edit_site: &EditSite) -> LemmyResult<()> {

View file

@ -27,7 +27,7 @@ use lemmy_utils::error::{LemmyErrorExt, LemmyErrorType, LemmyResult};
impl VoteView { impl VoteView {
pub fn to_post_actions_cursor(&self) -> PaginationCursor { pub fn to_post_actions_cursor(&self) -> PaginationCursor {
// This needs a person and post // This needs a person and post
let prefixes_and_ids = [('P', self.creator.id.0), ('O', self.item_id)]; let prefixes_and_ids = [('P', self.creator.id.0)];
PaginationCursor::new(&prefixes_and_ids) PaginationCursor::new(&prefixes_and_ids)
} }
@ -80,7 +80,6 @@ impl VoteView {
.filter(post_actions::like_score.is_not_null()) .filter(post_actions::like_score.is_not_null())
.select(( .select((
person::all_columns, person::all_columns,
post::id,
creator_community_actions creator_community_actions
.field(community_actions::received_ban) .field(community_actions::received_ban)
.nullable() .nullable()
@ -104,7 +103,7 @@ impl VoteView {
pub fn to_comment_actions_cursor(&self) -> PaginationCursor { pub fn to_comment_actions_cursor(&self) -> PaginationCursor {
// This needs a person and comment // This needs a person and comment
let prefixes_and_ids = [('P', self.creator.id.0), ('C', self.item_id)]; let prefixes_and_ids = [('P', self.creator.id.0)];
PaginationCursor::new(&prefixes_and_ids) PaginationCursor::new(&prefixes_and_ids)
} }
@ -155,7 +154,6 @@ impl VoteView {
.filter(comment_actions::like_score.is_not_null()) .filter(comment_actions::like_score.is_not_null())
.select(( .select((
person::all_columns, person::all_columns,
comment::id,
creator_community_actions creator_community_actions
.field(community_actions::received_ban) .field(community_actions::received_ban)
.nullable() .nullable()
@ -245,13 +243,11 @@ mod tests {
let mut expected_post_vote_views = [ let mut expected_post_vote_views = [
VoteView { VoteView {
creator: inserted_sara.clone(), creator: inserted_sara.clone(),
item_id: inserted_post.id.0,
creator_banned_from_community: false, creator_banned_from_community: false,
score: -1, score: -1,
}, },
VoteView { VoteView {
creator: inserted_timmy.clone(), creator: inserted_timmy.clone(),
item_id: inserted_post.id.0,
creator_banned_from_community: false, creator_banned_from_community: false,
score: 1, score: 1,
}, },
@ -274,13 +270,11 @@ mod tests {
let mut expected_comment_vote_views = [ let mut expected_comment_vote_views = [
VoteView { VoteView {
creator: inserted_timmy.clone(), creator: inserted_timmy.clone(),
item_id: inserted_comment.id.0,
creator_banned_from_community: false, creator_banned_from_community: false,
score: -1, score: -1,
}, },
VoteView { VoteView {
creator: inserted_sara.clone(), creator: inserted_sara.clone(),
item_id: inserted_comment.id.0,
creator_banned_from_community: false, creator_banned_from_community: false,
score: 1, score: 1,
}, },

View file

@ -15,7 +15,6 @@ pub mod impls;
/// A vote view for checking a post or comments votes. /// A vote view for checking a post or comments votes.
pub struct VoteView { pub struct VoteView {
pub creator: Person, pub creator: Person,
pub item_id: i32,
pub creator_banned_from_community: bool, pub creator_banned_from_community: bool,
pub score: i16, pub score: i16,
} }