Revert "CommunityPersonBanAdditionalInfo (partial)"

This reverts commit 158f7f0cd9.
pull/3755/head
dull b 2023-07-29 01:55:53 +00:00
parent 158f7f0cd9
commit 79a6bf003e
8 changed files with 12 additions and 35 deletions

View File

@ -11,7 +11,6 @@ use crate::{
CommunityModerator, CommunityModerator,
CommunityModeratorForm, CommunityModeratorForm,
CommunityPersonBan, CommunityPersonBan,
CommunityPersonBanAdditionalInfo,
CommunityPersonBanForm, CommunityPersonBanForm,
CommunityUpdateForm, CommunityUpdateForm,
}, },
@ -215,18 +214,6 @@ impl Bannable for CommunityPersonBan {
} }
} }
impl CommunityPersonBanAdditionalInfo {
pub fn into_full(self, community_id: CommunityId, person_id: PersonId) -> CommunityPersonBan {
CommunityPersonBan {
id: self.id,
published: self.published,
expires: self.expires,
community_id,
person_id,
}
}
}
impl CommunityFollower { impl CommunityFollower {
pub fn to_subscribed_type(follower: &Option<Self>) -> SubscribedType { pub fn to_subscribed_type(follower: &Option<Self>) -> SubscribedType {
match follower { match follower {

View File

@ -162,16 +162,6 @@ pub struct CommunityPersonBan {
pub expires: Option<chrono::NaiveDateTime>, pub expires: Option<chrono::NaiveDateTime>,
} }
#[derive(PartialEq, Eq, Debug)]
#[cfg_attr(feature = "full", derive(Queryable, Selectable))]
#[cfg_attr(feature = "full", diesel(table_name = community_person_ban))]
/// Like `CommunityPersonBan` but without `community_id` and `person_id`, which are usually already known
pub struct CommunityPersonBanAdditionalInfo {
pub id: i32,
pub published: chrono::NaiveDateTime,
pub expires: Option<chrono::NaiveDateTime>,
}
#[derive(Clone)] #[derive(Clone)]
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))] #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
#[cfg_attr(feature = "full", diesel(table_name = community_person_ban))] #[cfg_attr(feature = "full", diesel(table_name = community_person_ban))]

View File

@ -72,7 +72,7 @@ fn queries<'a>() -> Queries<
person::all_columns, person::all_columns,
aliases::person1.fields(person::all_columns), aliases::person1.fields(person::all_columns),
CommentAggregatesNotInComment::as_select(), CommentAggregatesNotInComment::as_select(),
CommunityPersonBanAdditionalInfo::as_select().nullable(), community_person_ban::all_columns.nullable(),
comment_like::score.nullable(), comment_like::score.nullable(),
aliases::person2.fields(person::all_columns).nullable(), aliases::person2.fields(person::all_columns).nullable(),
); );
@ -229,7 +229,7 @@ impl JoinView for CommentReportView {
Person, Person,
Person, Person,
CommentAggregatesNotInComment, CommentAggregatesNotInComment,
Option<CommunityPersonBanAdditionalInfo>, Option<CommunityPersonBan>,
Option<i16>, Option<i16>,
Option<Person>, Option<Person>,
); );

View File

@ -48,7 +48,7 @@ type CommentViewTuple = (
Post, Post,
Community, Community,
CommentAggregatesNotInComment, CommentAggregatesNotInComment,
Option<CommunityPersonBanAdditionalInfo>, Option<CommunityPersonBan>,
Option<CommunityFollower>, Option<CommunityFollower>,
Option<CommentSaved>, Option<CommentSaved>,
Option<PersonBlock>, Option<PersonBlock>,
@ -110,7 +110,7 @@ fn queries<'a>() -> Queries<
post::all_columns, post::all_columns,
community::all_columns, community::all_columns,
CommentAggregatesNotInComment::as_select(), CommentAggregatesNotInComment::as_select(),
CommunityPersonBanAdditionalInfo::as_select().nullable(), community_person_ban::all_columns.nullable(),
community_follower::all_columns.nullable(), community_follower::all_columns.nullable(),
comment_saved::all_columns.nullable(), comment_saved::all_columns.nullable(),
person_block::all_columns.nullable(), person_block::all_columns.nullable(),

View File

@ -40,7 +40,7 @@ type PostReportViewTuple = (
Community, Community,
Person, Person,
Person, Person,
Option<CommunityPersonBanAdditionalInfo>, Option<CommunityPersonBan>,
Option<i16>, Option<i16>,
PostAggregatesNotInPost, PostAggregatesNotInPost,
Option<Person>, Option<Person>,
@ -81,7 +81,7 @@ fn queries<'a>() -> Queries<
community::all_columns, community::all_columns,
person::all_columns, person::all_columns,
aliases::person1.fields(person::all_columns), aliases::person1.fields(person::all_columns),
CommunityPersonBanAdditionalInfo::as_select().nullable(), community_person_ban::all_columns.nullable(),
post_like::score.nullable(), post_like::score.nullable(),
PostAggregatesNotInPost::as_select(), PostAggregatesNotInPost::as_select(),
aliases::person2.fields(person::all_columns.nullable()), aliases::person2.fields(person::all_columns.nullable()),

View File

@ -51,7 +51,7 @@ type PostViewTuple = (
Post, Post,
Person, Person,
Community, Community,
Option<CommunityPersonBanAdditionalInfo>, Option<CommunityPersonBan>,
PostAggregatesNotInPost, PostAggregatesNotInPost,
Option<CommunityFollower>, Option<CommunityFollower>,
Option<PostSaved>, Option<PostSaved>,
@ -137,7 +137,7 @@ fn queries<'a>() -> Queries<
post::all_columns, post::all_columns,
person::all_columns, person::all_columns,
community::all_columns, community::all_columns,
CommunityPersonBanAdditionalInfo::as_select().nullable(), community_person_ban::all_columns.nullable(),
PostAggregatesNotInPost::as_select(), PostAggregatesNotInPost::as_select(),
community_follower::all_columns.nullable(), community_follower::all_columns.nullable(),
post_saved::all_columns.nullable(), post_saved::all_columns.nullable(),

View File

@ -48,7 +48,7 @@ type CommentReplyViewTuple = (
Community, Community,
Person, Person,
CommentAggregatesNotInComment, CommentAggregatesNotInComment,
Option<CommunityPersonBanAdditionalInfo>, Option<CommunityPersonBan>,
Option<CommunityFollower>, Option<CommunityFollower>,
Option<CommentSaved>, Option<CommentSaved>,
Option<PersonBlock>, Option<PersonBlock>,
@ -113,7 +113,7 @@ fn queries<'a>() -> Queries<
community::all_columns, community::all_columns,
aliases::person1.fields(person::all_columns), aliases::person1.fields(person::all_columns),
CommentAggregatesNotInComment::as_select(), CommentAggregatesNotInComment::as_select(),
CommunityPersonBanAdditionalInfo::as_select().nullable(), community_person_ban::all_columns.nullable(),
community_follower::all_columns.nullable(), community_follower::all_columns.nullable(),
comment_saved::all_columns.nullable(), comment_saved::all_columns.nullable(),
person_block::all_columns.nullable(), person_block::all_columns.nullable(),

View File

@ -49,7 +49,7 @@ type PersonMentionViewTuple = (
Community, Community,
Person, Person,
CommentAggregatesNotInComment, CommentAggregatesNotInComment,
Option<CommunityPersonBanAdditionalInfo>, Option<CommunityPersonBan>,
Option<CommunityFollower>, Option<CommunityFollower>,
Option<CommentSaved>, Option<CommentSaved>,
Option<PersonBlock>, Option<PersonBlock>,
@ -109,7 +109,7 @@ fn queries<'a>() -> Queries<
community::all_columns, community::all_columns,
aliases::person1.fields(person::all_columns), aliases::person1.fields(person::all_columns),
CommentAggregatesNotInComment::as_select(), CommentAggregatesNotInComment::as_select(),
CommunityPersonBanAdditionalInfo::as_select().nullable(), community_person_ban::all_columns.nullable(),
community_follower::all_columns.nullable(), community_follower::all_columns.nullable(),
comment_saved::all_columns.nullable(), comment_saved::all_columns.nullable(),
person_block::all_columns.nullable(), person_block::all_columns.nullable(),