mirror of
https://github.com/LemmyNet/lemmy.git
synced 2025-09-02 19:23:49 +00:00
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:
parent
87cbc2f370
commit
35af960f42
5 changed files with 4 additions and 19 deletions
|
@ -339,8 +339,6 @@ pub struct EditSite {
|
|||
/// The response for a site.
|
||||
pub struct SiteResponse {
|
||||
pub site_view: SiteView,
|
||||
/// deprecated, use field `tagline` or /api/v4/tagline/list
|
||||
pub taglines: Vec<()>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
|
|
|
@ -134,10 +134,7 @@ pub async fn create_site(
|
|||
local_site_rate_limit_to_rate_limit_config(&site_view.local_site_rate_limit);
|
||||
context.rate_limit_cell().set_config(rate_limit_config);
|
||||
|
||||
Ok(Json(SiteResponse {
|
||||
site_view,
|
||||
taglines: vec![],
|
||||
}))
|
||||
Ok(Json(SiteResponse { site_view }))
|
||||
}
|
||||
|
||||
fn validate_create_payload(local_site: &LocalSite, create_site: &CreateSite) -> LemmyResult<()> {
|
||||
|
|
|
@ -178,10 +178,7 @@ pub async fn update_site(
|
|||
local_site_rate_limit_to_rate_limit_config(&site_view.local_site_rate_limit);
|
||||
context.rate_limit_cell().set_config(rate_limit_config);
|
||||
|
||||
Ok(Json(SiteResponse {
|
||||
site_view,
|
||||
taglines: vec![],
|
||||
}))
|
||||
Ok(Json(SiteResponse { site_view }))
|
||||
}
|
||||
|
||||
fn validate_update_payload(local_site: &LocalSite, edit_site: &EditSite) -> LemmyResult<()> {
|
||||
|
|
|
@ -27,7 +27,7 @@ use lemmy_utils::error::{LemmyErrorExt, LemmyErrorType, LemmyResult};
|
|||
impl VoteView {
|
||||
pub fn to_post_actions_cursor(&self) -> PaginationCursor {
|
||||
// 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)
|
||||
}
|
||||
|
@ -80,7 +80,6 @@ impl VoteView {
|
|||
.filter(post_actions::like_score.is_not_null())
|
||||
.select((
|
||||
person::all_columns,
|
||||
post::id,
|
||||
creator_community_actions
|
||||
.field(community_actions::received_ban)
|
||||
.nullable()
|
||||
|
@ -104,7 +103,7 @@ impl VoteView {
|
|||
|
||||
pub fn to_comment_actions_cursor(&self) -> PaginationCursor {
|
||||
// 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)
|
||||
}
|
||||
|
@ -155,7 +154,6 @@ impl VoteView {
|
|||
.filter(comment_actions::like_score.is_not_null())
|
||||
.select((
|
||||
person::all_columns,
|
||||
comment::id,
|
||||
creator_community_actions
|
||||
.field(community_actions::received_ban)
|
||||
.nullable()
|
||||
|
@ -245,13 +243,11 @@ mod tests {
|
|||
let mut expected_post_vote_views = [
|
||||
VoteView {
|
||||
creator: inserted_sara.clone(),
|
||||
item_id: inserted_post.id.0,
|
||||
creator_banned_from_community: false,
|
||||
score: -1,
|
||||
},
|
||||
VoteView {
|
||||
creator: inserted_timmy.clone(),
|
||||
item_id: inserted_post.id.0,
|
||||
creator_banned_from_community: false,
|
||||
score: 1,
|
||||
},
|
||||
|
@ -274,13 +270,11 @@ mod tests {
|
|||
let mut expected_comment_vote_views = [
|
||||
VoteView {
|
||||
creator: inserted_timmy.clone(),
|
||||
item_id: inserted_comment.id.0,
|
||||
creator_banned_from_community: false,
|
||||
score: -1,
|
||||
},
|
||||
VoteView {
|
||||
creator: inserted_sara.clone(),
|
||||
item_id: inserted_comment.id.0,
|
||||
creator_banned_from_community: false,
|
||||
score: 1,
|
||||
},
|
||||
|
|
|
@ -15,7 +15,6 @@ pub mod impls;
|
|||
/// A vote view for checking a post or comments votes.
|
||||
pub struct VoteView {
|
||||
pub creator: Person,
|
||||
pub item_id: i32,
|
||||
pub creator_banned_from_community: bool,
|
||||
pub score: i16,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue